I want to design a route that queries one when there are id parameters and all when there are no id parameters.
router.get('/role/:id?' , role.find);
When there is no id parameter, I want to do paging for all queries, so I do this
router.get('/role/:id? /:page? /:count?' , role.find);
Then that unit test requests like this
Okay, it’s wrong
I don’t know how to change it. . .
router.get('/role/:page? /:count?' , role.find);
I didn’t watch the question just now. . .
Directly use two optional parameters, and then determine the number of parameters to determine whether the query is all or pagination.