Reading-Notes

Class 03 Summary :

Name 3 real world use cases where you’d want to change the request with custom middleware :

  1. parameters validation.
  2. Authentication
  3. Error Handling

True or false: The route handler is middleware? :

In what ways can a middleware function end the process and send data to the browser?

At what point in the request lifecycle can you “inject” middleware?

What can cause express to error with “Request headers sent twice, cannot start a second response” ?

Document the following Vocabulary Terms :

Term  
Middleware is a type of computer software that provides services to software applications beyond those available from the operating system.
Request Object the main entry point for an application to issue a request to the Library - all operations on a URL must use a Request object. The request object is application independent in that both servers and clients use the same Request class.
Response Object It is the object which communicates between the server and the output which is sent to the client.
Application Middleware a middleware that is bound to an instance of express, using app.use() and app.VERB().
Routing Middleware a middleware that bound to an instance of express.Router().
TDD a style of programming in three activities: coding, testing (in the form of writing unit tests) and design (in the form of refactoring)
Behavioral Testing a testing of the external behaviour of the program, also known as black box testing. It is usually a functional testing.

ES6 Classes :

Using Express Routing :

Express Routing :

Sources:

source1 source2 source3