December 2014
Intermediate to advanced
372 pages
7h 34m
English
CHAPTER 10
![]()
Abstraction
This chapter deals with code organization. Abstraction usually means breaking monolithic logic into a few pieces. Most of the techniques presented in this chapter can be applied to any Node.js code, not just Express.js code.
An Express.js app usually has a main file (app.js or server.js). You should try to keep this file as small as possible, because as it grows larger, it becomes harder to maintain. The most suitable types of code to use instead of a large main file are middleware and routes. Configuration statements can also be abstracted, but they are typically less numerous than routes, which might exceed 200 to 300. ...
Read now
Unlock full access