A
A
Andrey Okhotnikov2019-06-04 17:18:58
React
Andrey Okhotnikov, 2019-06-04 17:18:58

How to get optional parameters in a route?

NEXTjs.
How to implement getting all route parameters, for example, in such a request

https://www.site.ru/zhenskaja/odezhda/plat-ja?base_color=1461&p=1

The route is dynamic, how to get all the parameters?
I understood that it is necessary to transfer from the server via req, but the problem is with optional parameters, there can be as many as you like
server.get('/products/:category', (req, res) => app.render(req, res, '/catalog', {
      category: req.params.category,
    }));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-06-04
@tsepen

req.query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question