Last active
April 11, 2019 00:57
-
-
Save grantcarthew/c3d3efaacc96c34291419a1331b3437f to your computer and use it in GitHub Desktop.
medium-server.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server.js | |
const log = require('./logger').child(module) | |
const driver = require('./store/driver') | |
const app = require('./app') | |
const SERVERPORT = process.env.SERVERPORT | |
if (process.listeners('unhandledRejection').length < 1) { | |
process.on('unhandledRejection', (reason, promise) => { | |
console.error(reason) | |
process.exit(1) | |
}) | |
} | |
if (process.listeners('uncaughtException').length < 1) { | |
process.on('uncaughtException', function (err) { | |
console.error(err) | |
process.exit(1) | |
}) | |
} | |
// Server Initialization | |
async function main () { | |
log.info('Initializing connection to the database') | |
await driver.connect() | |
// Start up the server on the port specified | |
app.listen(SERVERPORT) | |
log.info('Web API Server - listening on port: ' + SERVERPORT) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, may be here, you should be requiring
app.js
?const app = require('./server')