1 module Rakka.Resource.Page
7 import Network.HTTP.Lucu
8 import Network.HTTP.Lucu.Utils
9 import Rakka.Environment
11 import Rakka.Resource.Page.Get
14 fallbackPage :: Environment -> [String] -> IO (Maybe ResourceDef)
16 | null path = return Nothing
17 | null $ head path = return Nothing
18 | not $ isUpper $ head $ head path = return Nothing -- /Foo/bar のような形式でない。
20 = return $ Just $ ResourceDef {
21 resUsesNativeThread = False
23 , resGet = Just $ handleGet env (toPageName path)
26 , resPut = Just $ handlePut env (toPageName path)
27 , resDelete = Just $ handleDelete env (toPageName path)
31 toPageName :: [String] -> PageName
32 toPageName = decodePageName . joinWith "/"
35 handlePut :: Environment -> PageName -> Resource ()
36 handlePut = fail "FIXME: not implemented"
39 handleDelete :: Environment -> PageName -> Resource ()
40 handleDelete = fail "FIXME: not implemented"