const express = require("express")
const app = express()
app.get("/", (req, res) => {
res.send("<html><p>hello world</p></html>")
})
app.get("/login", (req, res) => {
res.send("hello login")
})
app.get("/abc/:id/", (req, res) => {
res.send("hello abc")
})
app.get(/.*fly$/, (req, res) => {
res.send("hello fly")
})
app.get("/home", (req, res, next) => {
res.send("hello home")
next()
}, (req, res) => {
res.send({ list: [1, 2, 3] })
})
app.listen(3000, () => {
console.log("server start")
})
运行结果