Prepare Node App for Production

From Logic Wiki
Jump to: navigation, search


Installations

npm i helmet
npm i compression

Setting Up

in startup folder add prod.js file. All production related codes will go here

 const helmet = require('helmet');
 const compression = require('compression');

 module.exports = function(app) {
   app.use(helmet());
   app.use(compression());
 }

and in index module add this

require('./startup/prod')(app);

it can be put in environment == production check.