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

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

Edit this section

NodeRequestNextFunction

export interface NodeRequestNextFunction

Edit this section

PlatformNode

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

Edit this section

QwikCityNodeRequestOptions

export interface QwikCityNodeRequestOptions extends ServerRenderOptions

Extends: ServerRenderOptions

PropertyModifiersTypeDescription
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

Edit this section