Skip to content

Latest commit

 

History

History
43 lines (26 loc) · 2.2 KB

File metadata and controls

43 lines (26 loc) · 2.2 KB

Express REST API

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

  • handling errors
  • requesting query and params
  • changing the request and response

True or false: The route handler is middleware?

False

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

when the process is finish and sending the request

At what point in the request lifecycle can you “inject” middleware? After the request have been received.

What can cause express to error with “Request headers sent twice, cannot start a second response"? Document the following Vocabulary Terms

  1. Middleware

are functions that have access to the request object req, the response object res, and the next middleware function in the application’s request-response cycle. The next middleware function is commonly denoted by a variable named next.

  1. Response Object: Response object. It is the object which communicates between the server and the output which is sent to the client.

  2. Middleware is software that lies between an operating system and the applications running on it. Essentially functioning as hidden translation layer, middleware enables communication and data management for distributed applications

  3. Request Object is 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

  4. Routing Middleware defines the way in which the client requests are handled by the application endpoints. And when you make some routers in separate file, you can use them by using middleware

  5. Test Driven Development‬‏ Test-driven development (TDD) is a development technique where you must first write a test that fails before you write new functional code. TDD is being quickly adopted by agile software developers for development of application source code and is even being adopted by Agile DBAs for database development

  6. Behavioral Testing: is a structured study and analysis of a person’s behavior using various methods like interviews, direct supervision, and self-observation.