API β€Ί @builder.io/qwik-city/middleware/node

createQwikCity

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>;
};
ParameterTypeDescription
optsQwikCityNodeRequestOptions

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>; }

Edit this section

NodeRequestNextFunction

export interface NodeRequestNextFunction

Edit this section

PlatformNode

export interface PlatformNode
PropertyModifiersTypeDescription
incomingMessage?IncomingMessage | Http2ServerRequest(Optional)
node?string(Optional)
ssr?true(Optional)

Edit this section

QwikCityNodeRequestOptions

export interface QwikCityNodeRequestOptions extends ServerRenderOptions

Extends: ServerRenderOptions

PropertyModifiersTypeDescription
getClientConn?(req: IncomingMessage | Http2ServerRequest) => ClientConn(Optional) Provide a function that returns a ClientConn for the given request.
getOrigin?(req: IncomingMessage | Http2ServerRequest) => string | null(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.
origin?string(Optional)
static?{ root?: string; cacheControl?: string; }(Optional) Options for serving static files

Edit this section