Code Reading: Express.js
Oct 24, 2023
·
express
code-reading
Following are the list of the points that I find interesting while reading Express code.
- Express 4.x supports Node
v0.10. Due to this, code is not written in ES6. 'use strict'increase the performance.- When you write
app.set('view engine', 'something'), Express will check thesomethingmodule innode_modulesand load it. EJS uses this trick and due to this, you just have to write this line only. You don’t have to importejs(orsomethingin example). - All the repos under Express org on GitHub have either
index.jsif the package consists of only one file or the package code is within thelibfolder. - Express use some npm packages from pillarjs and JShttp GitHub orgs. If you’re thinking to build your own framework you might consider to use some of the packages from this orgs such as router, cookie, csrf, templation, etag, compressible, and so on.