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

Answer by Mahadi Hassan for Is starting express like this "const app =...

This is not a bad practise rather this is a short version of following code :var express = require('express');var app = express();

View Article


Answer by themefield for Is starting express like this "const app =...

Simply put, to create an identifier for reuse and better communication to readers.More thought just about require()Since require() takes the responsibility to load and cache modules, some argues that...

View Article


Answer by jfriend00 for Is starting express like this "const app =...

In general, your code should be the simplest and clearest way of reliably meeting your requirements. Any code that follows those simple guidelines will not be considered a bad practice in pretty much...

View Article

Answer by Marty for Is starting express like this "const app =...

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...

View Article

Is starting express like this "const app = require('express')()" considered...

So title says it all. Never seen anyone use this syntax.const app = require('express')()I like to keep the main js file lean and have everything in modules so all I have there is 15 lines including...

View Article

Browsing latest articles
Browse All 5 View Live


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