Search code examples
javascriptnode.jstypescriptfeathersjs

Passing a query parameters in javascript


I queried the data from the database by the passed parameters for example

http://localhost:3030/people?$skip=0&$limit=25&$sort[name]=0&description[$name]=rajiv

But I wanted to add an extra param but I don't want to use it or include it in a query , cause it will cause error , I just wanted to pass that to get the key and value. Supposed I want to add param table=people and the url would be

  http://localhost:3030/people?$skip=0&$limit=25&$sort[name]=0&description[$name]=rajiv&table=people

But adding the table=people param would cause an error cause it was included in the query and I dont want to include it , I just want to pass it for a purpose.

#error "message": "Unknown column 'table.people' in 'where clause'",

Can I pass a param in the url and not include it on a query ? Thanks.


Solution

  • You only want to pass the key,value pair to backend without including it in the url then what you can do is add it on the request header. here is more info https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Setting_HTTP_request_headers