Read 08 ~ Express Routing & Connected API
By Abdallah obaid
NAME | URL |
---|---|
Home | Home. |
Prep | Prep: Engineering Topics. |
Read 01 | Node Ecosystem, TDD, CI/CD. |
Read 02 | Classes, Inheritance, Functional. |
Read 03 | Data Modeling & NoSQL Databases. |
Read 04 | Advanced Mongo/Mongoose. |
Read 05 | Linked Lists. |
Read 06 | HTTP and REST. |
Read 07 | Express. |
Read 08 | Express Routing & Connected API. |
Read 09 | API Server. |
Read 10 | Stacks and Queues. |
Read 11 | Authentication. |
Read 12 | OAuth. |
Read 13 | Bearer Authorization. |
Read 14 | Access Control (ACL). |
Read 15 | Trees. |
Read 16 | Event Driven Applications. |
Express Routing & Connected API:-
## Router:
- Router It is a mini express application without all the bells and whistles of an express application, just the routing stuff.
- The Router allowed us to make our applications more modular and flexible than ever before by creating multiple instances of the Router and applying them accordingly.
- Using
express.Router()
multiple times allow us to define groups of routes - We can use route middleware to validate parameters using .param()
## Middleware:
- Any functions that invoked by Express.js routing layer before your final request handler is made.
- Have access to the request object ( req ), the response object ( res ), and the next function in the application’s request-response cycle.
- Middleware is a way to do something before a request is processed.
- The order you place your middleware and routes is very important. Everything will happen in the order that they appear. ## Modularizing :
- Modularizing ensures that external functionality is created in such a way that it isn’t dependent on other external functionality, a concept known as loose coupling.