snap-app-0.3.1: Simple modules for writing apps with Snap, abstracted from hpaste.

Safe HaskellNone

Snap.App.Controller

Description

Controller routing/handling.

Synopsis

Documentation

runHandler :: s -> c -> Pool -> Controller c s () -> Snap ()Source

Run a controller handler.

output :: Html -> Controller c s ()Source

Strictly renders HTML to Text before outputting it via Snap. This ensures that any lazy exceptions are caught by the Snap handler.

outputText :: Text -> Controller c s ()Source

Strictly renders text before outputting it via Snap. This ensures that any lazy exceptions are caught by the Snap handler.

goHome :: Controller c s ()Source

Generic redirect to home page.

justOrGoHome :: Maybe a -> (a -> Controller c s ()) -> Controller c s ()Source

Extract a Just value or go home.

getInteger :: ByteString -> Integer -> Controller c s IntegerSource

Get integer parmater.

getStringMaybe :: ByteString -> Controller c s (Maybe String)Source

Get string (maybe).

getPagination :: AppConfig c => String -> Controller c s PNSource

Get pagination data.