Get port number from various possible config locations.
$ npm install --save port-config
Looks for a port number defined in these locations:
- process.env.PORT (such as used on Heroku)
- process.env.npm_package_config_port (if set in your package.json under config.port)
- passed argument
- 3000
var portConfig = require('port-config')
// express app
app.listen(portConfig(), function() {
console.log('Express server listening on port ' + portConfig())
}
ISC © Raine Lourie