Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify port #33

Closed
MattiSG opened this issue Apr 7, 2016 · 1 comment · Fixed by #50
Closed

Allow to specify port #33

MattiSG opened this issue Apr 7, 2016 · 1 comment · Fixed by #50
Assignees

Comments

@MattiSG
Copy link
Member

MattiSG commented Apr 7, 2016

PORT=4800 npm start

> sgmap.ludwig@0.3.0 start /Users/sgmap/Dev/ludwig
> babel-node server.js

Express server listening on localhost:3000, in development mode

The PORT env variable is a very common convention. However, since most of the setup of this app is made through npm config, we should support port in the npm config (which will also make explicit the default port), overridable by env.PORT.

@MattiSG
Copy link
Member Author

MattiSG commented Apr 7, 2016

I see you're doing:

var env = app.get('env');
var config = {
    port:env['NODE_PORT'] || 3000,
    ip:env['NODE_IP'] || 'localhost'
};

But:

  1. NODE_PORT is very uncommon.
  2. You're mistaking app.get('env') with process.env. The former is more or less an equivalent of NODE_ENV and contains stuff like development or production, not the list of environment variables 😉

hoshin added a commit that referenced this issue May 23, 2016
Fix #33 : Port is now configureable via 'npm config'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant