Skip to content

Commit 593cef1

Browse files
docs: remove deprecated url.parse() from custom server example (#86986)
This PR updates the custom server documentation to remove usage of Node's deprecated `url.parse()` API. The example does not require URL parsing, since the `parsedUrl` argument is optional for the Next.js `RequestHandler`. Removing `url.parse()` avoids Node deprecation warnings (DEP0116, DEP0169) and keeps the example aligned with current best practices. ### What changed? - Removed the `url.parse()` import and usage. - Removed unused `parsedUrl` variable. - Updated both TS and JS examples to use `handle(req, res)` directly. ### Why? - `url.parse()` is deprecated in modern Node versions. - The example works without URL parsing. - Simplifies the docs and matches recommended APIs. Fixes #86951 and #83183 Co-authored-by: Joseph <[email protected]>
1 parent 4269026 commit 593cef1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/01-app/02-guides/custom-server.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ const handle = app.getRequestHandler()
2727

2828
app.prepare().then(() => {
2929
createServer((req, res) => {
30-
const parsedUrl = parse(req.url!, true)
31-
handle(req, res, parsedUrl)
30+
handle(req, res)
3231
}).listen(port)
32+
})
3333

3434
console.log(
3535
`> Server listening at http://localhost:${port} as ${
@@ -51,9 +51,9 @@ const handle = app.getRequestHandler()
5151

5252
app.prepare().then(() => {
5353
createServer((req, res) => {
54-
const parsedUrl = parse(req.url, true)
55-
handle(req, res, parsedUrl)
54+
handle(req, res)
5655
}).listen(port)
56+
})
5757

5858
console.log(
5959
`> Server listening at http://localhost:${port} as ${

0 commit comments

Comments
 (0)