You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
337 B
20 lines
337 B
4 months ago
|
const express = require("express")
|
||
|
|
||
|
const app = express()
|
||
|
|
||
|
app.use(fun())
|
||
|
// 注意这里直接调用函数,所以直接加括号
|
||
|
|
||
|
function fun(){
|
||
|
return (req,res,next)=>{
|
||
|
console.log(req.url);
|
||
|
console.log(req.method);
|
||
|
next()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
app.get("/",(req,res)=>{
|
||
|
res.send("xsxaxasxasx")
|
||
|
})
|
||
|
|
||
|
app.listen(80)
|