Read: Class 09 : API Server - Goorob-401-advanced-javascript/amman-javascript-401d1 GitHub Wiki
- Express: Router Parameters : Those are both pretty extreme. Middleware that has to run on 10 out of 15 of your routes (e.g. any route with a city) requires you to either put it on all the routes and make it ignore the requests without a city (ugly) or put that special middleware on every route with a city parameter (also ugly).
Mongoose is a schema driven ORM, which gives us the opportunity to provide structure to our Mongo documents. By default, Mongo (all NoSQL Databases, really) are not structured by default. Mongoose takes some of that pain away from us as developers and allows us to provide some level of rules and validation around our data models.
- Joining Data/Documents in Mongo :
There are definitely other scenarios where you’ll want data to be joined in real time. Take for example, a sports team, where you have a list of teams and a list of players. Generally speaking, players only play on one team at a time. So when modeling a team with a list of players, it would be advantageous to somehow link those two collections together