Skip to content

Instantly share code, notes, and snippets.

@dino-su
Last active December 16, 2015 07:13
Show Gist options
  • Save dino-su/1eddee73508ef7ee5323 to your computer and use it in GitHub Desktop.
Save dino-su/1eddee73508ef7ee5323 to your computer and use it in GitHub Desktop.
NODE_ENV

$ node index.js // local url

$ NODE_ENV=heroku node index.js // heroku url

var env = process.env.NODE_ENV || 'local';
function config() {
'use strict';
switch(env) {
case 'local':
return 'local url';
case 'heroku':
return 'heroku url';
default:
throw new Error('Undefined environment:' + env);
}
}
module.exports = config;
var env = require('./env.js')();
console.log(env);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment