# 七.中间件

person.js

let express = require("express")

let router = express.Router()
router.get("/add", function (req, res) {
  res.send("人的添加")
})

module.exports
1
2
3
4
5
6
7
8
let express = require("express")
let app = express()

app.use("person", person)
app.get("/", function () {
  res.send("")
})
app.listen(3000)
1
2
3
4
5
6
7
8