bugfix - require order causing env to load to early

This commit is contained in:
Michael Shanks 2020-05-14 16:26:14 +01:00
parent e6b4598c82
commit eabcb48bba
1 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@ if (env.LOGGER !== "off") app.use(logger())
app.use(api.routes()) app.use(api.routes())
module.exports = async port => { module.exports = async port => {
port = port || env.PORT || 4001
const server = http.createServer(app.callback()) const server = http.createServer(app.callback())
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
server.on("error", e => { server.on("error", e => {
@ -27,4 +28,4 @@ module.exports = async port => {
resolve(server) resolve(server)
}) })
}) })
} }