Reading notes for Code Fellows!
After researching numerous sources including but not limited to Express.docs, GitHub, StackOverflow MDN Web Docs, there appears to be plenty debate over whether route handlers are middleware or not. The debates touch on topics such as the absence of the next
argument, the handlers association with HTTP request verbs, whether middleware delivers a response to a request and other criteria. In my opinion, they are not middleware, they are ‘handlers’ (callback functions for routes/requests), but I can not support that interpretation with any hard evidence.
Middleware can be ‘injected’ anytime after the request has been made and before a response has been returned. During the time that the request is “in the tunnel” between request and response.
This means that for a given client request the server previously sent a response back to the client and now is unexpectedly trying to send another response to the same request. Understanding Node Error [ERR_HTTP_HEADERS_SENT] by Prosper Opara
| Vocabulary Term | Definition |
| — | — |
| Middleware | Middleware are functions executed in the middle, after the incoming request then produces an output A Simple Explanation of Express Middleware |
| Request Object | The request object represents the HTTP request and has properties for the request string, parameters, body HTTP headers, and more TutorialsPoint |
| Response Object | The response object is data returned from the server to a client following an HTTP request, and has many properties much like a request object
| Application Middleware | Middleware that is bound to an instance of the app object such as app.use()
and app.get()
and other HTTP verbs that facilitates functionality of the application |
| Routing Middleware | Router-level middleware works in the same way as application-level middleware, except it is bound to an instance of express.Router()
Expressjs |
| Test Driven Development | *A software development process relying on software requirements being converted to test cases before software is fully developed, and tracking all software development by repeatedly testing the software against all test cases. This is opposed to software being developed first and test cases created later. Wikipedia |
| Behavorial Testing | An Agile software development process that encourages collaboration among developers, QA and non-technical or business participants in a software project. It encourages teams to use conversation and concrete examples to formalize a shared understanding of how the application should behave. Wikipedia |
express.Router()
express.Router()