Skip to content

Commit 3482064

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 4218d87 commit 3482064

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
@@ -50,18 +50,18 @@ In addition to environment variables from the `node_server` preset, you can cust
5050

5151
## Handler (advanced)
5252

53-
**Preset:** `node`
53+
**Preset:** `node_middleware`
5454

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

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

5959
**Example:**
6060

6161
```js
6262
import { createServer } from 'node:http'
63-
import { listener } from './.output/server'
63+
import { middleware } from './.output/server'
6464

65-
const server = createServer(listener)
65+
const server = createServer(middleware)
6666
server.listen(8080)
6767
```

0 commit comments

Comments
 (0)