Home > @poq/proxy-middleware > ProxyMiddlewareFactory > create
Method creates proxy middleware to bypass requests from intermediate server to Poq platform.
Signature:
static create(options?: ProxyMiddlewareOptions): IMiddlewareHandler;
Parameter | Type | Description |
---|---|---|
options | ProxyMiddlewareOptions | (Optional) Proxy handler option to tune target, cookie path and other settings |
Returns:
Middleware handler for proxying requests.
Method creates combined middleware that comprises http header sanitizer, headers validator and proxy handler.
// What it have inside.
const proxyComplexMiddleware = MiddlewareUtils.compose(
ValidateHeadersMiddlewareFactory.create(),
SanitizeHeadersMiddlewareFactory.create(),
ProxyMiddlewareFactory.createPureProxyMiddleware(options)
);
const middleaware = ProxyMiddlewareFactory.create(proxyOptions);
app.get('/someroute', middleware);