One exit for errors
Do not format errors inside every route. Send failed requests to one error-handling middleware, then shape the response there.
In Express, an error handler has four arguments: err, req, res, next. Put it after your routes.
Why this matters
A recruiter will test your API with wrong IDs, missing fields, bad JSON, and broken requests. If each route returns errors differently, your project feels unfinished.
A central handler makes your API predictable. Your success responses stay in routes. Your failure responses stay in one place.