How do you detect the environment in an express.js app?

后端 未结 6 994
谎友^
谎友^ 2020-12-23 01:48

How do you detect what environment an expressJS app is running in? (development, test, production?). There\'s nothing in process.env indicating an environment..

6条回答
  •  攒了一身酷
    2020-12-23 02:44

    cannot access the nodejs server. can detect node env from express using app.setting.env

    1. var app = express();
    2. app.setting.env render to the template engine.
    3. check from the browser.

提交回复
热议问题