Poq.SDK.Node

Home > @poq/proxy-middleware > ProxyMiddlewareFactory > create

ProxyMiddlewareFactory.create() method

Method creates proxy middleware to bypass requests from intermediate server to Poq platform.

Signature:

static create(options?: ProxyMiddlewareOptions): IMiddlewareHandler;

Parameters

Parameter Type Description
options ProxyMiddlewareOptions (Optional) Proxy handler option to tune target, cookie path and other settings

Returns:

IMiddlewareHandler

Middleware handler for proxying requests.

Remarks

Method creates combined middleware that comprises http header sanitizer, headers validator and proxy handler.

Example

// What it have inside.
const proxyComplexMiddleware = MiddlewareUtils.compose(
 ValidateHeadersMiddlewareFactory.create(),
 SanitizeHeadersMiddlewareFactory.create(),
 ProxyMiddlewareFactory.createPureProxyMiddleware(options)
);

const middleaware = ProxyMiddlewareFactory.create(proxyOptions);

app.get('/someroute', middleware);