Skip to content

Instantly share code, notes, and snippets.

@grantcarthew
Last active April 11, 2019 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantcarthew/c3d3efaacc96c34291419a1331b3437f to your computer and use it in GitHub Desktop.
Save grantcarthew/c3d3efaacc96c34291419a1331b3437f to your computer and use it in GitHub Desktop.
medium-server.js
// 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()
@jhcaiced
Copy link

Hi, may be here, you should be requiring app.js ? const app = require('./server')

@grantcarthew
Copy link
Author

Your are right @jhcaiced. I copied this prior to file name changes. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment