Reading 9 API Server - morgan-401-advanced-javascript/seattle-javascript-401n14 GitHub Wiki

Reading: API Server

Read

express router.param() middleware

Link Adds callback triggers to route parameters, where name is the name of the parameter and callback is the callback function. Although name is technically optional, using this method without it is deprecated starting with Express v4.11.0 (see below).

The parameters of the callback function are:

req, the request object. res, the response object. next, indicating the next middleware function. The value of the name parameter. The name of the parameter. Unlike app.param(), router.param() does not accept an array of route parameters.

For example, when :user is present in a route path, you may map user loading logic to automatically provide req.user to the route, or perform validations on the parameter input.

mongoose middleware

Link

Skim and Bookmark

mongoose subdocs

Link

mongoose populate virtuals

Link