runServer :: IO ()
runServer = do
configureLogger
staticDir <- getStaticDir
redirectUrlGraphEmail <- retrieveAuthURL testUrl
redirectUrlGraphPost <- retrieveAuthURL testPostUrl
aboutContents <- LazyIO.readFile $ markdownPath ++ "README.md"
privacyContents <- LazyIO.readFile $ markdownPath ++ "PRIVACY.md"
-- Start the HTTP server
simpleHTTP serverConf $ do
decodeBody (defaultBodyPolicy "/tmp/" 4096 4096 4096)
msum [ do
nullDir
seeOther "graph" (toResponse "Redirecting to /graph"),
dir "grid" gridResponse,
dir "graph" graphResponse,
dir "image" graphImageResponse,
dir "timetable-image" $ look "courses" >>= \x -> look "session" >>= timetableImageResponse x,
dir "graph-fb" $ seeOther redirectUrlGraphEmail $ toResponse "",
dir "post-fb" $ seeOther redirectUrlGraphPost $ toResponse "",
dir "test" $ look "code" >>= getEmail,
dir "test-post" $ look "code" >>= postToFacebook,
dir "post" postResponse,
dir "draw" drawResponse,
dir "about" $ aboutResponse aboutContents,
dir "privacy" $ privacyResponse privacyContents,
dir "static" $ serveDirectory DisableBrowsing [] staticDir,
dir "course" $ look "name" >>= retrieveCourse,
dir "all-courses" $ liftIO allCourses,
dir "graphs" $ liftIO queryGraphs,
dir "course-info" $ look "dept" >>= courseInfo,
dir "depts" $ liftIO deptList,
dir "timesearch" searchResponse,
dir "calendar" $ lookCookieValue "selected-lectures" >>= calendarResponse,
dir "get-json-data" $ look "graphName" >>= \graphName -> liftIO $ getGraphJSON graphName,
dir "loading" $ look "size" >>= loadingResponse,
dir "save-json" $ look "jsonData" >>= \jsonStr -> look "nameData" >>= \nameStr -> liftIO $ saveGraphJSON jsonStr nameStr,
notFoundResponse
]
関数msumの後のリスト([]にあるのでリストだと思います)、dirの後のすべてがルートですか?happstack コードでルートはどのように見えるべきですか? 私はこのコードで完全に迷っています。