/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v16.3.0
examples/custom-server/server.ts
19 строк
476 B
MOHAMMED WASIM KHAN
fix: remove deprecated url.parse() from custom-server example (#96105)
24 июл 2026, 01:04
Не верифицирован
24 июл 2026, 01:04
3ab9d19
Код
Авторство
О чём код?
import { createServer } from "http"; import next from "next"; const port = parseInt(process.env.PORT || "3000", 10); const dev = process.env.NODE_ENV !== "production"; const app = next({ dev }); const handle = app.getRequestHandler(); app.prepare().then(() => { createServer((req, res) => { handle(req, res); }).listen(port); console.log( `> Server listening at http://localhost:${port} as ${ dev ? "development" : process.env.NODE_ENV }`, ); });