A route is registered
What I want to design is to pass in the id one operation and not pass in the id parameter another operation.
However, if you do not pass the id parameter, it will be 404. I can only register another one.
I feel this usage is very strange.
The koa-router module is used.
The parameter you write like this is called
path variable, which is a required part of routing, should be used if you want to be an optional parameter.
I haven’t seen this before.
koa-router, I am in accordance with the standard
httpThe access logic suggested it, but after reading the document, I found that this thing is not a normal abnormal condition (almost Jabberwocky), so my above suggestion cannot be used.
Here’s how it works:
router.get('/user/:id?' , user.find);
Then when the client accesses, it can not fill in
/user/This access, see the document:
koa, don’t know what kind of logic this is, I refuse to obey
Regarding routing specifications, in the:
By another librarypath-to-regexpTo deal with