How to organize routes

So far, our routes and their handlers have been written right in the app file. It might work for small apps, but is not practical for bigger projects. After a certain level of complexity in our app, we will need to organize your routes.

So what is the Express way of organizing routes?

The Express way of organizing routes is—chose what works best for you. Express does not force, recommend, or suggest any form of routing pattern on its developers. However, it provides the capability to implement any sort of routing pattern you may want to implement for your app.

There are three popular ways of organizing routes in an Express app; let's explore them.

Using Node modules

In Chapter 1, What is Express?, we learned that Node modules ...

Get Express Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.