0

I want to send multiple objects in link and be able to get them in my server side. Currently I am trying this:

<a href="?page={{ page }}+?filter={{data.sort}}">{{ page }}</a>

The result I get with console.log(req.query):

GET /products?filterlist=price-high 200 96.523 ms
{ page: '2 ?filter=price-high' }

Is it possible to get object with two (or multiple) parameters?

{ page: '2', filter: 'price-high' }
Juozas Rastenis
  • 265
  • 3
  • 9

2 Answers2

1

You can pass in multiple parameters in the following manner -

products?filterlist=price-high&abc=def

0

What I found was that nodejs has special symbol in link: "&" So now if we assign this symbol in the link:

<a href="?page={{ page }}&filter={{data.sort}}">{{ p }}</a>

The result I get in req.query is:

{ page: '2', filter: 'price-high' }
Juozas Rastenis
  • 265
  • 3
  • 9
  • "that nodejs has special symbol in link" — That is standard URL syntax and has been since before JavaScript existed. It isn't anything special for node. – Quentin May 22 '18 at 09:29