zoukankan      html  css  js  c++  java
  • Express拦截器

    https://cnodejs.org/topic/512d8172df9e9fcc58333c73
    Express+Nodejs 下的登录拦截实现

    app.js中:

    //-----------拦截器的实现-------------------------------------
    var openPage = ['/','/users/zhuce','/users/login','/users/logout'];

    app.use(function(req, res, next) {
      var url = req.originalUrl;
      if(openPage.indexOf(url)>-1){
        next();
      }else{
        if(req.session.loginbean){
          next();
        }else{
          res.redirect('/');
        }
      }
    });
    //-------------------------------------------------------------

  • 相关阅读:
    POJ 2209
    POJ 2196
    POJ 2215
    POJ 2192
    POJ 2195
    POJ 2181
    POJ 2182
    POJ 2159
    POJ 2153
    字符设备驱动 —— 字符设备驱动框架
  • 原文地址:https://www.cnblogs.com/xintao/p/11652685.html
Copyright © 2011-2022 走看看