Having built a set of MongooseJS models and schemas, it would be nice to use them in a web application, right? Of course it would! But before we dive in deep with using our models to load and display data, there's a pressing matter of routes and route organization in ExpressJS applications.
It turns out Express v4 has a very powerful route handling system – one that allows you to very easily organize your routes and route handler functions. Unfortunately, the default, generated express app.js and route handlers are not organized very well. This tends to lead to bad practices, as bad example don't point us in the right direction.
In this episode, then, I'll dig in to Express v4's router objects and show you how to organize your routes and route handler functions in a way that will scale up with your application. I'll also show you some basics of handling routes with parameters along the way, and make use of the Blog Post and User objects that we had previously created in the MongooseJS screencast series.