Chapter 12. Best practices
This chapter covers
- Benefits of simplicity in your code
- Structuring your app’s files
- Using the npm shrinkwrap command to lock down dependency versions for reliability (and the benefits of doing so)
- Avoiding installing modules globally
It’s time to bring this book to a close.
If this book were a tragedy, we’d probably end with a dramatic death. If it were a comedy, we might have a romantic wedding. Unfortunately, this is a book about Express, a topic not known for its drama and romance. The best you’ll get is this: a set of best practices for large Express applications. I’ll do my best to make it romantic and dramatic.
With small applications, organization doesn’t matter much. You can fit your app in a single file or a handful of small files. But as your apps become larger, these considerations become more important. How should you organize your files so that your codebase is easy to work with? What kind of conventions should you adhere to in order to best support a team of developers?