Saturday, 14 July 2018

Req.params vs query strings

Hi, I was wondering what is the difference between query strings and req.params, suppose I have a website where I want to get the information about a city, I could have a route /city/London - here I uses req.params to find a city with the name London in my DB. I could also have city/?city=London - here I use query strings to find and retrive London from my DB. So what is the difference, when is it better to use one over another? Thanks in advance ;)

Submitted July 14, 2018 at 12:46PM by everek123

No comments:

Post a Comment