An event handler is the Servant-side function that processes an HTTP request and produces a response. Its type connects route inputs and request bodies to a Handler result, making the implementation match the declarative API. section 14.2.1
The basic Handler type is ExceptT ServerError IO: it permits real effects while converting failures into Servant-compatible HTTP errors. A direct handler can connect to a database, query it, and return a domain value.
Matching handlers to routes
For a partitioned AstroAPI, method handlers accept exactly the captured identifiers and request bodies declared by the routes. The server assembles them with :<|>: submitObjectTemplate :<|> getObject :<|> submitObjectOrbital :<|> submitObjectPhysical.
Keep the handler at the HTTP boundary when designing a maintainable service:
- Avoid placing substantial business logic directly in Handler; that approach is described as difficult to test, easy to break, imperative, and impure. section 14.2.2
- Move domain-aware operations into AppL, then let a Servant handler invoke the application scenario rather than coupling domain code to framework interfaces. section 14.2.2





















