API › @builder.io/qwik-city/middleware/node
createQwikCity
export declare function createQwikCity(opts: QwikCityNodeRequestOptions): {
router: (
req: IncomingMessage,
res: ServerResponse,
next: NodeRequestNextFunction
) => Promise<void>;
notFound: (
req: IncomingMessage,
res: ServerResponse,
next: (e: any) => void
) => Promise<void>;
staticFile: (
req: IncomingMessage,
res: ServerResponse,
next: (e?: any) => void
) => Promise<void>;
};| Parameter | Type | Description |
|---|---|---|
| opts | QwikCityNodeRequestOptions |
Returns:
{ router: (req: IncomingMessage, res: ServerResponse, next: NodeRequestNextFunction) => Promise<void>; notFound: (req: IncomingMessage, res: ServerResponse, next: (e: any) => void) => Promise<void>; staticFile: (req: IncomingMessage, res: ServerResponse, next: (e?: any) => void) => Promise<void>; }
NodeRequestNextFunction
export interface NodeRequestNextFunctionPlatformNode
export interface PlatformNode| Property | Modifiers | Type | Description |
|---|---|---|---|
| incomingMessage? | IncomingMessage | (Optional) | |
| node? | string | (Optional) | |
| ssr? | true | (Optional) |
QwikCityNodeRequestOptions
export interface QwikCityNodeRequestOptions extends ServerRenderOptionsExtends: ServerRenderOptions
| Property | Modifiers | Type | Description |
|---|---|---|---|
| getClientConn? | (req: IncomingMessage) => ClientConn | (Optional) | |
| origin? | string | (Optional) 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) or derived from the incoming request. | |
| static? | { root?: string; cacheControl?: string; } | (Optional) Options for serving static files |