首页 > 其他 > 详细

express添加拦截器

时间:2015-11-29 17:51:47      阅读:331      评论:0      收藏:0      [点我收藏+]
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();
  });
});

express添加拦截器

原文:http://www.cnblogs.com/walk-the-Line/p/5005047.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!