Applications grow, sometimes quickly. Code gets written, shoved in to files and we move on to the next feature. Over time, the code begins to get out of hand, and suddenly the once clean router folder and application “lib” is a mess! It happens to all of us – none of us are immune to the growth of applications and the need to organize and re-organize our code.
In this episode, I'll show you how I organize my “business” code and separate it from the application shell of the Express application. I'll show you how the “lib” folder I create is used, how I split my code in to multiple modules within that, and what I do to get rid of the dreaded “../../../” problems in NodeJS require statements.
If you're doing any work with Express applications and you're getting tired of junk-drawer folders and convoluted router files, you should be watching this (and other other Express episodes).