sv.js add as start script
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
"dev:debug": "cross-env NODE_OPTIONS='--inspect' next dev --turbopack --port 1976",
|
||||
"build": "next build",
|
||||
"start:loc": "next start --port 1976",
|
||||
"start": "next start --hostname 127.1.4.78",
|
||||
"start": "NODE_ENV=production node sv.js",
|
||||
"lint": "next lint",
|
||||
"tsql": "prisma generate --sql",
|
||||
"tsql:w": "prisma generate --sql --watch"
|
||||
|
||||
21
sv.js
Normal file
21
sv.js
Normal 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
|
||||
}`
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user