Code Reading: Express.js

Oct 24, 2023

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 the something module in node_modules and load it. EJS uses this trick and due to this, you just have to write this line only. You don’t have to import ejs (or something in example).
  • All the repos under Express org on GitHub have either index.js if the package consists of only one file or the package code is within the lib folder.
  • 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.
Tags: express code-reading