Issue
For use in express.js environments. Any suggestions?
Solution
Before running your app, you can do this in console,
export NODE_ENV=production
Or if you are in windows you could try this:
SET NODE_ENV=production
for PowerShell:
$env:NODE_ENV="production"
or you can run your app like this:
NODE_ENV=production node app.js
You can also set it in your js file:
process.env.NODE_ENV = 'production';
But I don't suggest to do it in your runtime file, since it's not easy to open up VIM in your server and change it to production. You can make a config.json file in your directory and everytime your app runs, it reads from it and sets the configuration.
Answered By - Farid Nouri Neshat Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.