What is a route in Express?
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.
Verify This Answer
Cross-check this information using these trusted sources:
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
