express里面的路由劫持

劫持

var myLogger = function (req, res, next) {
if(['/user/add','/user/delete','/user/update'].includes(req.path)){
if(!req.cookies['token']) {
res.status(403).json({code: 403, message: 'token无效!'});
} else {
next();
}
} else {
next();
}
};

app.use(myLogger);

posted on 2024-04-07 18:35  漫思  阅读(8)  评论(0编辑  收藏  举报

导航