|
|
|
|
In this exercise, you are going to build root-level middleware. As you have seen in challenge 4, to mount a middleware function at root level, you can use the <code>app.use(<mware-function>)</code> method. In this case, the function will be executed for all the requests, but you can also set more specific conditions. For example, if you want a function to be executed only for POST requests, you could use <code>app.post(<mware-function>)</code>. Analogous methods exist for all the HTTP verbs (GET, DELETE, PUT, …).
|