Building the Bookstore REST API with Express: Routers, Validation with zod, Async Error Handling and Problem Details
A solid REST API with Express separates its layers, validates every request with a zod schema and derives the type from it, turns errors into RFC 9457 Problem Details in one middleware, and keeps money as whole numbers of kuruş instead of floats. With real output: an order total of 1339.1999999999998, a float sum drifting by 5 kuruş over 20 million lines, validation returning six errors in one response, the same Problem Details contract as ASP.NET Core, paging, and z.toJSONSchema.
14 Nov 2026
·
13 min
·
14