版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/adley_app/article/details/83993952
const express = require('express');
const app = express();
app.get('/detail', handle1, handle2, (req,res) => {
res.send('detail page~');
})
/**
* 中间件
*/
function handle1(req, res, next){
let {num} = req.query;
if(num > 10){
next('大于10,不满足要求');
}else {
next();
}
}
function handle2(req, res, next){
let { num } = req.query;
if(num == 10){
next('等于10 ...');
}else {
next();
}
}
app.listen(8080)