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 themefield for Is starting express like this "const app = require('express')()" considered bad practice?

$
0
0

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 it should be placed before app initialization. I see many example codes follows this style. However I think it really depends on how the package/code quality is ensured in the specific project.


Viewing all articles
Browse latest Browse all 5

Trending Articles



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