Quantcast
Channel: Is starting express like this "const app = require('express')()" considered bad practice? - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Answer by Marty for Is starting express like this "const app = require('express')()" considered bad practice?

$
0
0

Something to consider is that the express module exposes some other functionality that you might want to make use of later (e.g. express.static). In your case you would have to require express again to gain access to it:

app.use(require('express').static());

Other than that there is no reason it's "bad practise". It just depends on what you intend to leverage from the module.


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>