Passenger runs a literal JS entry file, not the next start CLI or an npm script, so a custom server was needed for cPanel's Node.js App startup file field.
15 lines
354 B
JavaScript
15 lines
354 B
JavaScript
const { createServer } = require('http')
|
|
const next = require('next')
|
|
|
|
const port = parseInt(process.env.PORT || '3000', 10)
|
|
const app = next({ dev: false })
|
|
const handle = app.getRequestHandler()
|
|
|
|
app.prepare().then(() => {
|
|
createServer((req, res) => {
|
|
handle(req, res)
|
|
}).listen(port, () => {
|
|
console.log(`> Ready on port ${port}`)
|
|
})
|
|
})
|