packages/docs/src/routes/api/qwik-city-middleware-node/index.mdx
export declare function createQwikCity(opts: QwikCityNodeRequestOptions): {
router: (
req: IncomingMessage | Http2ServerRequest,
res: ServerResponse,
next: NodeRequestNextFunction,
) => Promise<void>;
notFound: (
req: IncomingMessage | Http2ServerRequest,
res: ServerResponse,
next: (e: any) => void,
) => Promise<void>;
staticFile: (
req: IncomingMessage | Http2ServerRequest,
res: ServerResponse,
next: (e?: any) => void,
) => Promise<void>;
};
Parameter
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td>opts
</td><td> </td><td> </td></tr> </tbody></table>Returns:
{ router: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse, next: NodeRequestNextFunction) => Promise<void>; notFound: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse, next: (e: any) => void) => Promise<void>; staticFile: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse, next: (e?: any) => void) => Promise<void>; }
<h2 id="noderequestnextfunction">NodeRequestNextFunction</h2>export interface NodeRequestNextFunction
export interface PlatformNode
Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>IncomingMessage | Http2ServerRequest
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>string
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>true
</td><td>(Optional)
</td></tr> </tbody></table> <h2 id="qwikcitynoderequestoptions">QwikCityNodeRequestOptions</h2>export interface QwikCityNodeRequestOptions extends ServerRenderOptions
Extends: ServerRenderOptions
<table><thead><tr><th>Property
</th><th>Modifiers
</th><th>Type
</th><th>Description
</th></tr></thead> <tbody><tr><td> </td><td> </td><td>(req: IncomingMessage | Http2ServerRequest) => ClientConn
</td><td>(Optional) Provide a function that returns a ClientConn for the given request.
(req: IncomingMessage | Http2ServerRequest) => string | null
</td><td>(Optional) Provide a function that computes the origin of the server, used to resolve relative URLs and validate the request origin against CSRF attacks.
When not specified, it defaults to the ORIGIN environment variable (if set).
If ORIGIN is not set, it's derived from the incoming request, which is not recommended for production use. You can specify the PROTOCOL_HEADER, HOST_HEADER to X-Forwarded-Proto and X-Forwarded-Host respectively to override the default behavior.
string
</td><td>(Optional)
</td></tr> <tr><td> </td><td> </td><td>{ root?: string; cacheControl?: string; }
</td><td>(Optional) Options for serving static files
</td></tr> </tbody></table>