buildApp function
Composes the full request handler: JSON error mapping, CORS, then the router.
This is the testable seam — drive it with shelf Requests, no socket.
Implementation
Handler buildApp(ServerDependencies deps) => const Pipeline()
.addMiddleware(jsonErrors())
.addMiddleware(corsHeaders(deps.config.corsAllowOrigins))
.addHandler(buildRouter(deps).call);