Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Here is an example of loading a series of middleware functions at a mount point, with a mount path. It illustrates a middleware sub-stack that prints request info for any type of HTTP request to the /user/:id path.

app.use('/user/:id', (req, res, next) => {
  console.log('Request URL:', req.originalUrl)
  next()
}, (req, res, next) => {
  console.log('Request Type:', req.method)
  next()
})
Source by expressjs.com #
 
PREVIOUS NEXT
Tagged: #Here #loading #series #middleware #functions #mount #mount #It #illustrates #middleware #prints #request #info #type #HTTP #request
ADD COMMENT
Topic
Name
3+2 =