Module

Yoga.HTTP.API.Route.RouteHandler

Package
purescript-yoga-http-api
Repository
rowtype-yoga/purescript-yoga-http-api

#Handler Source

data Handler t0

A handler tied to a specific route type.

Usage: userHandler :: Handler UserRoute userHandler = mkHandler { path } -> ...

#RouteHandler Source

class RouteHandler :: Type -> Row Type -> Row Type -> Row Type -> Type -> Row Type -> Constraintclass RouteHandler (route :: Type) (pathParams :: Row Type) (queryParams :: Row Type) (reqHeaders :: Row Type) (body :: Type) (respVariant :: Row Type) | route -> pathParams queryParams reqHeaders body respVariant

Type class that computes the handler function type from a Route type.

Instances

#mkHandler Source

mkHandler :: forall route pathParams queryParams reqHeaders body respVariant. RouteHandler route pathParams queryParams reqHeaders body respVariant => HandlerFn pathParams queryParams reqHeaders body respVariant -> Handler route

Create a Handler from a function matching the route's type.

#runHandler Source

runHandler :: forall route pathParams queryParams reqHeaders body respVariant. RouteHandler route pathParams queryParams reqHeaders body respVariant => Handler route -> HandlerFn pathParams queryParams reqHeaders body respVariant

Extract the handler function from a Handler.

#APIHandlers Source

class APIHandlers :: RowList Type -> Row Type -> Constraintclass APIHandlers (rl :: RowList Type) (handlerRow :: Row Type) | rl -> handlerRow

Instances

#apiHandlers Source

apiHandlers :: forall @api apiRow rl handlerRow. ApiRecord api apiRow => RowToList apiRow rl => APIHandlers rl handlerRow => Record handlerRow -> Record handlerRow

#ApiRecord Source

class ApiRecord :: Type -> Row Type -> Constraintclass ApiRecord (api :: Type) (row :: Row Type) | api -> row

Instances