apiary-2.0.1: Simple and type safe web framework that generate web API documentation.

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Apiary

Contents

Synopsis

Documentation

data ApiaryT exts prms actM m a Source

Apiary monad. since 0.8.0.0.

Instances

(Monad actM, MonadBase b m) => MonadBase b (ApiaryT exts prms actM m) Source 
(Monad actM, MonadBaseControl b m) => MonadBaseControl b (ApiaryT exts prms actM m) Source 
Monad actM => MonadExts exts (ApiaryT exts prms actM m) Source 
Monad actM => MonadTrans (ApiaryT exts prms actM) Source 
Monad actM => MonadTransControl (ApiaryT exts prms actM) Source 
Monad actM => Monad (ApiaryT exts prms actM m) Source 
Functor (ApiaryT exts prms actM m) Source 
Monad actM => Applicative (ApiaryT exts prms actM m) Source 
(Monad actM, MonadIO m) => MonadIO (ApiaryT exts prms actM m) Source 
type StT (ApiaryT exts prms actM) a Source 
type StM (ApiaryT exts prms actM m) a = ComposeSt (ApiaryT exts prms actM) m a Source 

Runner

Apiary -> Application

runApiaryTWith :: (Monad actM, Monad m) => (forall b. actM b -> IO b) -> (Application -> m a) -> Initializer m `[]` exts -> ApiaryConfig -> ApiaryT exts `[]` actM m () -> m a Source

run Apiary monad.

runApiaryWith :: Monad m => (Application -> m a) -> Initializer m `[]` exts -> ApiaryConfig -> ApiaryT exts `[]` IO m () -> m a Source

runApiary :: Monad m => (Application -> m a) -> ApiaryConfig -> ApiaryT `[]` `[]` IO m () -> m a Source

getApiaryTWith :: (Monad actM, Monad m) => (forall b. actM b -> IO b) -> Initializer m `[]` exts -> ApiaryConfig -> ApiaryT exts `[]` actM m () -> m Application Source

get Application from Apiary monad. since 2.0.0.

getApiaryWith :: Monad m => Initializer m `[]` exts -> ApiaryConfig -> ApiaryT exts `[]` IO m () -> m Application Source

getApiary :: Monad m => ApiaryConfig -> ApiaryT `[]` `[]` IO m () -> m Application Source

data ApiaryConfig Source

Constructors

ApiaryConfig 

Fields

notFound :: Application

call when no handler matched.

defaultStatus :: Status

used unless call status function.

defaultHeaders :: ResponseHeaders

initial headers.

defaultContentType :: ByteString
 
failStatus :: Status
 
failHeaders :: ResponseHeaders
 
maxRequestSize :: Word64

maximum request size, default to 5MB. since 2.0.0.

uploadFilePath :: Maybe FilePath

where to store upload file. since 2.0.0.

default to Nothing, which saves file content in memory. NOTE. once you set this value to some path, it's your responsibility to clean uploaded files. eg. move or remove it.

rootPattern :: [Text]

used by root filter.

mimeType :: FilePath -> ByteString
 

execute action

action :: Monad actM => ActionT exts prms actM () -> ApiaryT exts prms actM m () Source

splice ActionT to ApiaryT.

middleware

middleware :: Monad actM => Middleware -> ApiaryT exts prms actM m () Source

add middleware.

please note that, this method just provide a shortcut to stack middleware. middlewares are added to whole Apiary application rather than specific route.

API documentation

group :: Text -> Filter' exts actM m Source

API document group. since 0.12.0.0.

only top level group recognized.

document :: Text -> Filter' exts actM m Source

add API document. since 0.12.0.0.

It use only filters prior document, so you should be placed document directly in front of action.

precondition :: Html -> Filter' exts actM m Source

add user defined precondition. since 0.13.0.

noDoc :: Filter' exts actM m Source

ignore next document.

not export from Web.Apiary

apiaryConfig :: Monad actM => ApiaryT exts prms actM m ApiaryConfig Source

get Apiary configuration.

apiaryExt :: (Has e exts, Monad actM) => proxy e -> ApiaryT exts prms actM m e Source

Deprecated: use getExt

get Apiary extension.