35
loading...
This website collects cookies to deliver better user experience
Logging all requests coming to the server (Morgan is a very popular middleware used for this purpose)
To verify if the request has auth token
or not (Passcode JS is a popular middleware for this purpose)
var express = require('express')
var app = express()
app.use(function (req, res, next){
console.log('Time', Date.now())
next()
})
app.use("/products/:id", function(req,res,next){
console.log('Request Type: ', req.method)
next()
})
app.get("/products/:id", function(req,res,next){
res.send('product')
next()
})
app.use("/categories",categories)
app.use(middleware)