2016-12-16 21:33:08 +01:00
|
|
|
const express = require('express')
|
|
|
|
const next = require('next')
|
|
|
|
|
2017-08-10 20:15:46 +02:00
|
|
|
const port = parseInt(process.env.PORT, 10) || 3000
|
2016-12-28 19:12:24 +01:00
|
|
|
const dev = process.env.NODE_ENV !== 'production'
|
2017-01-16 18:24:33 +01:00
|
|
|
const app = next({ dev })
|
2016-12-16 21:33:08 +01:00
|
|
|
const handle = app.getRequestHandler()
|
|
|
|
|
2018-12-17 17:34:32 +01:00
|
|
|
app.prepare().then(() => {
|
|
|
|
const server = express()
|
2016-12-16 21:33:08 +01:00
|
|
|
|
2019-09-11 16:23:41 +02:00
|
|
|
server.all('*', (req, res) => {
|
2018-12-17 17:34:32 +01:00
|
|
|
return handle(req, res)
|
|
|
|
})
|
2016-12-16 21:33:08 +01:00
|
|
|
|
2020-05-18 21:24:37 +02:00
|
|
|
server.listen(port, (err) => {
|
2018-12-17 17:34:32 +01:00
|
|
|
if (err) throw err
|
|
|
|
console.log(`> Ready on http://localhost:${port}`)
|
2016-12-16 21:33:08 +01:00
|
|
|
})
|
2018-12-17 17:34:32 +01:00
|
|
|
})
|