express添加拦截器

var express = require('express')
  , routes = require('./routes')
  , http = require('http')
  , path = require('path');

var app = express();

app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  // 第1个filter
  app.use(function (req, res, next) {
    console.log(req.headers.host);
    next();
  });
  // 第2个filter
  app.use(function (req, res, next) {
    console.log(req.headers.host);
    next();
  });
  // 第3个filter
  app.use(function (req, res, next) {
    console.log(req.headers.host);
    next();
  });
});
坚持,坚持,再坚持。
原文地址:https://www.cnblogs.com/walk-the-Line/p/5005047.html