webgear-server-0.1.0: Composable, type-safe library to build HTTP API servers
Copyright(c) Raghu Kaippully 2020
LicenseMPL-2.0
Maintainerrkaippully@gmail.com
Safe HaskellNone
LanguageHaskell2010

WebGear.Route

Description

Types and functions to route HTTP requests.

Synopsis

Documentation

type RouterT m = ExceptT (Maybe (First (Response ByteString))) m Source #

The monad transformer stack for routing.

class (Alternative m, MonadPlus m) => MonadRouter m where Source #

HTTP request routing with short circuiting behavior.

Methods

rejectRoute :: m a Source #

Mark the current route as rejected, alternatives can be tried

failHandler :: Response ByteString -> m a Source #

Short-circuit the current handler and return a response

Instances

Instances details
Monad m => MonadRouter (RouterT m) Source # 
Instance details

Defined in WebGear.Route

runRoute :: Monad m => Handler (RouterT m) '[] res ByteString -> Request -> m Response Source #

Convert a routable handler into a plain function.

This function is typically used to convert WebGear routes to a Application.