Assigning Middleware to a Single Route

You can also apply body-parser middleware to a single route by passing it after the path parameter. For example, in the following code, requests to /parsedRoute will be logged, but requests to /otherRoute will not be logged:

var express = require('express'),
var bodyParser = require('body-parser'),
var app = express();
app.get('/parsedRoute', bodyParser(), function(req, res) {
  res.send('This request was logged.'),
});
app.get('/otherRoute', function(req, res) {
  res.send('This request was not logged.'),
});

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.53.166