Node.js, express, and using development versus production in app.configure

后端 未结 5 1488
孤城傲影
孤城傲影 2020-12-07 14:44

What is the easiest method to let express know what environment I am in? E.g. I want do do the below to make a connection to redis depending on what env I am in. Can this

5条回答
  •  难免孤独
    2020-12-07 15:44

    Just set the NODE_ENV environment variable to production or development, as seen in express' docs: http://expressjs.com/guide.html#configuration

    I just leave NODE_ENV=development in the dev machine's ~/.profile (.bashrc or bash_profile on linux), and do the same for production ones.

提交回复
热议问题