Frame.Router
Description
Definitions and functions for building a router
- class (FrameConfig m, FrameState m, FrameIO m) => FrameRouter m
- fileFolder :: FrameRouter m => String -> [String] -> m Data
- type Router = [String] -> StateT Vars (ReaderT Config IO) Data
- startRouter :: Router -> Config -> Validators -> [(FieldName, String)] -> String -> String -> Bool -> IO Data
Documentation
class (FrameConfig m, FrameState m, FrameIO m) => FrameRouter m Source
Instances
(FrameConfig m, FrameState m, FrameIO m) => FrameRouter m |
Arguments
:: FrameRouter m | |
=> String | Folder on the file system |
-> [String] | Exploded URL |
-> m Data | Either an Error404 or the File |
The fileFolder
function maps a URL to a filesystem folder
type Router = [String] -> StateT Vars (ReaderT Config IO) DataSource
A router maps from a path (list of URL parts) to some Data
Arguments
:: Router | The router being executed |
-> Config | The configuration |
-> Validators | Validators to check fields against |
-> [(FieldName, String)] | Initial fields (from the server) |
-> String | The URL (from the server) |
-> String | The session ID |
-> Bool | Whether this is an Ajax request |
-> IO Data | The data to be returned |
Executes a given router and validators against request information from the server