Answer the question
In order to leave comments, you need to log in
Express.js routing pagination question
Hello!
The question is how to set up routes in express.js to accept such requests localhost/somethings?take=10&skip=15
You can of course just receive a request for /somethings and there already determine whether the parameters were passed or not. But I would like to make it more beautiful. On the Internet, I found only options with a slash, for example, /somethings/take/10/skip/15 - but this is not beautiful in my opinion.
It seems all the same to determine such a route, is it possible without regular expressions?
Answer the question
In order to leave comments, you need to log in
Define the somethings route, and in the action itself we are already looking:
var take = req.param('take') || 10,
skip = req.param('skip') || 0;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question