Skip to content

raineorshine/port-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

port-config

npm version

Get port number from various possible config locations.

Install

$ npm install --save port-config

Usage

Looks for a port number defined in these locations:

  1. process.env.PORT (such as used on Heroku)
  2. process.env.npm_package_config_port (if set in your package.json under config.port)
  3. passed argument
  4. 3000
var portConfig = require('port-config')

// express app
app.listen(portConfig(), function() {
  console.log('Express server listening on port ' + portConfig())
}

License

ISC © Raine Lourie

About

Get port number from various possible config locations.

Resources

License

Stars

Watchers

Forks

Packages

No packages published