A binding between an HTTP method, a URL path, and a handler function. app.get('/users/:id', getUser) is a route. Express dispatches the matching handler when a request comes in.
Express Routing Interview Questions and Answers
What is a route in Express?
The answer
More FAQs in Express Routing Interview Questions and Answers
In declaration order. The first matching route wins. This is why specific routes must come before wildcards, and /me before /:id. Wrong order causes silent bugs where routes never get hit.
In Express 4, wrap with asyncHandler that catches promise rejections and calls next(err). In Express 5, async errors are caught automatically. Use a custom ApiError class with status and message.
It passes control to the next middleware or handler. Without next(), the request hangs. With next(err), Express skips to the error handler. Every middleware must call next() or send a response.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.