express路由
# GET
app.get('/', function (req, res) {
res.send('GET request to the homepage')
})
1
2
3
2
3
# POST
app.post('/', function (req, res) {
res.send('POST request to the homepage')
})
1
2
3
2
3
# 任意类型请求
app.all('/secret', function (req, res, next) {
console.log('Accessing the secret section ...')
next() // pass control to the next handler
})
1
2
3
4
2
3
4
# 路径
上次更新: 2023/09/22, 16:54:32