0

Can we set up node environment without using any npm package or any framework on top of node. That is can we do it using the features coming with node set up only ?

Our environments can be like NODE_ENV=production, NODE_ENV=development

  • http://stackoverflow.com/questions/4870328/how-to-read-environment-variable-in-node-js Using process.env.ENV_VARIABLE worked –  Nov 26 '14 at 14:20

1 Answers1

0

you can simply use global variables. In general you need to handle different domains, different paths for your db, different ways of logging. Consider samething like this:

var domain = 127.0.0.1;
//var domain = your_public_domain;
var db_path = 127.0.0.1:3000;
//var db_path = your_production_path;

for logging you can use some logger module, like wiston.

Maybe there is a better way to do it but this is what i do!

radar155
  • 1,796
  • 2
  • 11
  • 28