Difference between revisions of "Prepare Node App for Production"

From Logic Wiki
Jump to: navigation, search
(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...")
 
(No difference)

Latest revision as of 16:46, 9 November 2018


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.