InterviewBuddy
All interview questions

How do route parameters and query parameters differ in Express?

Beginner

Answer

Route parameters identify values embedded in a route path. Query parameters carry optional request settings such as filters or pagination.

Explanation

Validate both before using them; URL input is controlled by the caller.

Example

GET /users/42?sort=name → req.params.id and req.query.sort