While I am starting to get a hold of NodeJS programming, I am a bit confused by when to use request params and how their practical use differs from using query strings.

In particular, I can do localhost:8080/:param1 in the URL followed by req.params in the code or localhost:8080/?param1=value in the URL followed by req.query in the code, and get the same outcome - the value of param1. How should I decide when to use which? What is a good use case for either of these approaches?

1 Answer 1


You use


when you are referring to a resource, as in


You use


when you are supplying a parameter to a request, as in


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.