Unverified Commit 3ab9d196 authored by MOHAMMED WASIM KHAN's avatar MOHAMMED WASIM KHAN Committed by GitHub

fix: remove deprecated url.parse() from custom-server example (#96105)

Fixes #86951

Removes the deprecated legacy `url.parse()` API (DEP0169) from the
custom-server example. The `parsedUrl` parameter is optional, so the
simplest fix is to remove the `parse()` call and pass only `(req, res)`
to the handler, matching the docs code block that was already updated in
#86986.
parent 6c6d1632
import { createServer } from "http"; import { createServer } from "http";
import { parse } from "url";
import next from "next"; import next from "next";
const port = parseInt(process.env.PORT || "3000", 10); const port = parseInt(process.env.PORT || "3000", 10);
...@@ -9,8 +8,7 @@ const handle = app.getRequestHandler(); ...@@ -9,8 +8,7 @@ const handle = app.getRequestHandler();
app.prepare().then(() => { app.prepare().then(() => {
createServer((req, res) => { createServer((req, res) => {
const parsedUrl = parse(req.url!, true); handle(req, res);
handle(req, res, parsedUrl);
}).listen(port); }).listen(port);
console.log( console.log(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment