Skip to content

Commit a47c3ae

Browse files
docs(node): fix handler preset name and export
The Handler (advanced) section referenced preset `node` and export `listener`, but `node` is an alias for `node-server` (not the middleware handler). The actual preset name is `node-middleware` and the export is `middleware`. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d7a52c0 commit a47c3ae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/2.deploy/10.runtimes/1.node.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ In addition to environment variables from the `node_server` preset, you can cust
5252

5353
## Handler (advanced)
5454

55-
**Preset:** `node`
55+
**Preset:** `node_middleware`
5656

57-
Nitro also has a more low-level preset that directly exports a function with `(req, res) => {}` signature usable for middleware and custom servers.
57+
Nitro also has a more low-level preset that directly exports a Node.js compatible handler usable for middleware and custom servers.
5858

59-
When running `nitro build` with the Node preset, the result will be an entry point exporting a function with the `(req, res) => {}` signature.
59+
When running `nitro build` with the Node middleware preset, the result will be an entry point exporting a `middleware` handler.
6060

6161
**Example:**
6262

6363
```js
6464
import { createServer } from 'node:http'
65-
import { listener } from './.output/server'
65+
import { middleware } from './.output/server'
6666

67-
const server = createServer(listener)
67+
const server = createServer(middleware)
6868
server.listen(8080)
6969
```

0 commit comments

Comments
 (0)