Questions for using Express.js:
Code:
app.use(A)
app.use(B)
{
const isCurlR = app.use(function (req, res, next) {
next()
})
isCurlR.get('/getLatest', (req, res) => {})
}
{
const isNotCurlR = app.use(function (req, res, next) {
next()
})
isNotCurlR.get('/getLogs', (req, res) => {})
isNotCurlR.get('/getCard', (req, res) => {})
}
Router workflow:
A → B → isCurlR → isNotCurlR → /getLatest
A → B → isCurlR → /getLogs
I want: A → B → isNotCurlR → /getLatest
https://i.sstatic.net/ecc0M.png
When trying to access /cli, the isCurlR method works correctly,
However, when visiting /web, it first calls the isCurlR method,
But it should directly use the isNotCurlR method
I prefer not to complicate the interface path. Currently, I achieve this effect using the golang gin library.