Skip to content

Instantly share code, notes, and snippets.

@stewhouston
Created May 20, 2016 20:53
Show Gist options
  • Save stewhouston/8ed61cab3cde5db506d72ecf53485597 to your computer and use it in GitHub Desktop.
Save stewhouston/8ed61cab3cde5db506d72ecf53485597 to your computer and use it in GitHub Desktop.
// @note start server with pm2 in production
module.exports = (function() {
const argv = require('yargs').argv;
const env = argv.env || process.env.NODE_ENV || 'dev';
const port = <number> argv.port || 3000;
var app = require('express')();
const octvConfig = require('./octv.environments')(env);
const bootstrap = require('./bootstrap');
bootstrap(app, octvConfig);
let server = app.listen(port, function () {
console.log('App serving at http://%s:%s', server.address().address, server.address().port);
console.log('Current environment is:', env);
})
.on('error', function() {
console.log('Application server error:', { 'args': arguments });
});
return server;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment