sv.js add as start script

This commit is contained in:
2025-02-07 08:47:19 +02:00
parent c6c34f0453
commit fa272c636c
2 changed files with 22 additions and 1 deletions

21
sv.js Normal file
View File

@@ -0,0 +1,21 @@
const { createServer } = require('http');
const { parse } = require('url');
const next = require('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) => {
const parsedUrl = parse(req.url, true);
handle(req, res, parsedUrl);
}).listen(port, '127.1.4.78');
console.log(
`> Server listening at http://localhost:${port} as ${
dev ? 'development' : process.env.NODE_ENV
}`
);
});