Mercurial > hg > Members > toma > bulletinboard
view Routes.hs @ 7:24ef053a4dc5
add function that editMessageUsingGet
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 27 Jan 2014 03:03:07 +0900 |
parents | 782efee9766c |
children |
line wrap: on
line source
{-# LANGUAGE OverloadedStrings #-} module Routes ( routes ) where import Jungle import Types import RouteSetting import Network.Wai (Response, responseLBS) import Network.Wai.Parse (Param) import Network.HTTP.Types (status404) import Network.HTTP.Types.URI (Query) import Data.Text (Text) routes :: [Text] -> (Jungle -> Query -> [Param] -> IO Response) routes path = findRoute path routeSetting findRoute path [] = notFound findRoute path ((p,f):xs) | path == p = f | otherwise = findRoute path xs notFound :: Jungle -> Query -> [Param] -> IO Response notFound _ _ _ = return $ responseLBS status404 [("Content-type", "text/html")] $ "404 - File Not Found"