---
title: \@qwik.dev/qwik-router/middleware/node API Reference
---

# [API](/api) &rsaquo; @qwik.dev/qwik-router/middleware/node

<h2 id="createqwikcity">createQwikCity</h2>

> Warning: This API is now obsolete.
>
> Use `createQwikRouter` instead. Will be removed in V3

```typescript
createQwikCity: typeof createQwikRouter;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)

<h2 id="createqwikrouter">createQwikRouter</h2>

```typescript
export declare function createQwikRouter(
  opts: QwikRouterNodeRequestOptions | QwikCityNodeRequestOptions,
): QwikRouterNodeMiddleware;
```

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead>
<tbody><tr><td>

opts

</td><td>

[QwikRouterNodeRequestOptions](#qwikrouternoderequestoptions) \| [QwikCityNodeRequestOptions](#qwikcitynoderequestoptions)

</td><td>

</td></tr>
</tbody></table>

**Returns:**

[QwikRouterNodeMiddleware](#qwikrouternodemiddleware)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)

<h2 id="noderequestnextfunction">NodeRequestNextFunction</h2>

```typescript
export interface NodeRequestNextFunction
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)

<h2 id="platformnode">PlatformNode</h2>

```typescript
export interface PlatformNode
```

<table><thead><tr><th>

Property

</th><th>

Modifiers

</th><th>

Type

</th><th>

Description

</th></tr></thead>
<tbody><tr><td>

incomingMessage?

</td><td>

</td><td>

IncomingMessage \| Http2ServerRequest

</td><td>

_(Optional)_

</td></tr>
<tr><td>

node?

</td><td>

</td><td>

string

</td><td>

_(Optional)_

</td></tr>
<tr><td>

ssr?

</td><td>

</td><td>

true

</td><td>

_(Optional)_

</td></tr>
</tbody></table>

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)

<h2 id="qwikcitynoderequestoptions">QwikCityNodeRequestOptions</h2>

> Warning: This API is now obsolete.
>
> Use `QwikRouterNodeRequestOptions` instead. Will be removed in V3

```typescript
export type QwikCityNodeRequestOptions = QwikRouterNodeRequestOptions;
```

**References:** [QwikRouterNodeRequestOptions](#qwikrouternoderequestoptions)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)

<h2 id="qwikrouternodemiddleware">QwikRouterNodeMiddleware</h2>

```typescript
export interface QwikRouterNodeMiddleware
```

<table><thead><tr><th>

Property

</th><th>

Modifiers

</th><th>

Type

</th><th>

Description

</th></tr></thead>
<tbody><tr><td>

notFound

</td><td>

</td><td>

(req: IncomingMessage \| Http2ServerRequest, res: ServerResponse, next: (e: any) =&gt; void) =&gt; Promise&lt;void&gt;

</td><td>

</td></tr>
<tr><td>

router

</td><td>

</td><td>

(req: IncomingMessage \| Http2ServerRequest, res: ServerResponse, next: [NodeRequestNextFunction](#noderequestnextfunction), limits?: [QwikRouterNodeRequestLimits](#qwikrouternoderequestlimits)) =&gt; Promise&lt;void&gt;

</td><td>

</td></tr>
<tr><td>

staticFile

</td><td>

</td><td>

(req: IncomingMessage \| Http2ServerRequest, res: ServerResponse, next: (e?: any) =&gt; void) =&gt; Promise&lt;void&gt;

</td><td>

</td></tr>
</tbody></table>

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)

<h2 id="qwikrouternoderequestlimits">QwikRouterNodeRequestLimits</h2>

```typescript
export interface QwikRouterNodeRequestLimits
```

<table><thead><tr><th>

Property

</th><th>

Modifiers

</th><th>

Type

</th><th>

Description

</th></tr></thead>
<tbody><tr><td>

bodyLimit?

</td><td>

</td><td>

number

</td><td>

_(Optional)_ Maximum request body size in bytes imposed by the host.

</td></tr>
</tbody></table>

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)

<h2 id="qwikrouternoderequestoptions">QwikRouterNodeRequestOptions</h2>

```typescript
export interface QwikRouterNodeRequestOptions extends ServerRenderOptions
```

**Extends:** ServerRenderOptions

<table><thead><tr><th>

Property

</th><th>

Modifiers

</th><th>

Type

</th><th>

Description

</th></tr></thead>
<tbody><tr><td>

getClientConn?

</td><td>

</td><td>

(req: IncomingMessage \| Http2ServerRequest) =&gt; ClientConn

</td><td>

_(Optional)_ Provide a function that returns a `ClientConn` for the given request.

</td></tr>
<tr><td>

getOrigin?

</td><td>

</td><td>

(req: IncomingMessage \| Http2ServerRequest) =&gt; 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.

</td></tr>
<tr><td>

origin?

</td><td>

</td><td>

string

</td><td>

_(Optional)_

</td></tr>
<tr><td>

requestBodyLimit?

</td><td>

</td><td>

number

</td><td>

_(Optional)_ Maximum request body size in bytes. Defaults to 10 MiB.

</td></tr>
<tr><td>

static?

</td><td>

</td><td>

\{ root?: string; cacheControl?: string; }

</td><td>

_(Optional)_ Options for serving static files

</td></tr>
</tbody></table>

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/middleware/node/index.ts)
