Дело вкуса?
app.get("/products/:productId", function (request, response) {
response.send("productId: " + request.params["productId"])
});
/products/1
/products/2
/products/3
И так далее...
request.params["productId"]
будет лежать ID продукта, по которому можно из базы достать информацию. app.get('/api/v1', function middleware (req, res, next) {
// this function is middleware
req.locals.middlewareObject = { name: 'middleware', called: true }
next()
}, function otherMiddleware (req, res, next) {
// this function is middleware too
return res.json(req.locals.middlewareObject)
})