mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
3f47a87c79
* Initial dev server * Remove obsolete check * Move hotReloader to dev-server * Use parent renderErrorToHTML to remove dep on render.js * Remove dev option from server itself
15 lines
457 B
JavaScript
15 lines
457 B
JavaScript
import http from 'http'
|
|
import next from '../next'
|
|
|
|
export default async function start (serverOptions, port, hostname) {
|
|
const app = next(serverOptions)
|
|
await app.prepare()
|
|
const srv = http.createServer(app.getRequestHandler())
|
|
await new Promise((resolve, reject) => {
|
|
// This code catches EADDRINUSE error if the port is already in use
|
|
srv.on('error', reject)
|
|
srv.on('listening', () => resolve())
|
|
srv.listen(port, hostname)
|
|
})
|
|
}
|