apiary-0.6.0.0: Simple web framework inspired by scotty.

Safe HaskellNone

Control.Monad.Apiary.Action

Contents

Synopsis

Documentation

data ApiaryConfig Source

Constructors

ApiaryConfig 

Fields

notFound :: Application

call when no handler matched.

defaultStatus :: Status

used unless call status function.

defaultHeader :: ResponseHeaders

initial headers.

rootPattern :: [ByteString]

used by root filter.

mimeType :: FilePath -> ByteString
 

actions

stop :: Monad m => ActionT m aSource

stop handler and send current state. since 0.3.3.0.

stopWith :: Monad m => Response -> ActionT m aSource

stop with response. since 0.4.2.0.

getter

getRequest :: Monad m => ActionT m RequestSource

get raw request. since 0.1.0.0.

getHeaders :: Monad m => ActionT m RequestHeadersSource

get all request headers. since 0.6.0.0.

setter

status :: Monad m => Status -> ActionT m ()Source

set status code. since 0.1.0.0.

response header

addHeader :: Monad m => HeaderName -> ByteString -> ActionT m ()Source

add response header. since 0.1.0.0.

setHeaders :: Monad m => ResponseHeaders -> ActionT m ()Source

set response headers. since 0.1.0.0.

modifyHeader :: Monad m => (ResponseHeaders -> ResponseHeaders) -> ActionT m ()Source

modify response header. since 0.1.0.0.

contentType :: Monad m => ByteString -> ActionT m ()Source

set content-type header. if content-type header already exists, replace it. since 0.1.0.0.

response body

file :: Monad m => FilePath -> Maybe FilePart -> ActionT m ()Source

set response body file content and detect Content-Type by extension. since 0.1.0.0.

file' :: Monad m => FilePath -> Maybe FilePart -> ActionT m ()Source

set response body file content, without set Content-Type. since 0.1.0.0.

builder :: Monad m => Builder -> ActionT m ()Source

set response body builder. since 0.1.0.0.

lbs :: Monad m => ByteString -> ActionT m ()Source

set response body lazy bytestring. since 0.1.0.0.

source :: Monad m => Source IO (Flush Builder) -> ActionT m ()Source

set response body source. since 0.1.0.0.

monolithic action

redirect

redirectSource

Arguments

:: Monad m 
=> Status 
-> ByteString

Location redirect to

-> ActionT m a 

redirect handler

set status, location header and stop. since 0.3.3.0.

redirectPermanently :: Monad m => ByteString -> ActionT m aSource

redirect with 301 Moved Permanently. since 0.3.3.0.

redirectFound :: Monad m => ByteString -> ActionT m aSource

redirect with 302 Found. since 0.3.3.0.

redirectSeeOther :: Monad m => ByteString -> ActionT m aSource

redirect with 303 See Other. since 0.3.3.0.

redirectTemporary :: Monad m => ByteString -> ActionT m aSource

redirect with 307 Temporary Redirect. since 0.3.3.0.

Reexport