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
12 import System.FilePath
15 fallbackPage :: Environment -> [String] -> IO (Maybe ResourceDef)
17 | null path = return Nothing
18 | null $ head path = return Nothing
19 | not $ isUpper $ head $ head path = return Nothing -- /Foo/bar のような形式でない。
21 = return $ Just $ ResourceDef {
22 resUsesNativeThread = False
24 , resGet = Just $ handleGet env (toPageName path)
27 , resPut = Just $ handlePut env (toPageName path)
28 , resDelete = Just $ handleDelete env (toPageName path)
31 toPageName :: [String] -> PageName
32 toPageName = decodePageName . dropExtension . joinWith "/"
35 handlePut :: Environment -> PageName -> Resource ()
36 handlePut = fail "FIXME: not implemented"
39 handleDelete :: Environment -> PageName -> Resource ()
40 handleDelete = fail "FIXME: not implemented"