rsnext/examples/with-ioc/server.js
Alex Indigo e401e2cf5f Added IoC example (#3595)
* Added `with-ioc` example

* pre-compile deps until we get nextjs magic working
2018-01-31 08:36:20 +01:00

17 lines
446 B
JavaScript

const { createServer } = require('http')
const next = require('next')
const routes = require('./routes')
const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handler = routes.getRequestHandler(app)
app.prepare()
.then(() => {
createServer(handler)
.listen(port, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})