Prepare Node App for Production

From Logic Wiki
Revision as of 16:46, 9 November 2018 by AliIybar (Talk | contribs) (Created page with "Category:Node.js == Installations == npm i helmet npm i compression == Setting Up == in startup folder add prod.js file. All production related codes will go here <pre...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.