haskell - What should a Route look like in Happstack code? -


runserver :: io () runserver =     configurelogger     staticdir <- getstaticdir     redirecturlgraphemail <- retrieveauthurl testurl     redirecturlgraphpost <- retrieveauthurl testposturl     aboutcontents <- lazyio.readfile $ markdownpath ++ "readme.md"     privacycontents <- lazyio.readfile $ markdownpath ++ "privacy.md" -- start http server simplehttp serverconf $   decodebody (defaultbodypolicy "/tmp/" 4096 4096 4096)   msum [           nulldir           seeother "graph" (toresponse "redirecting /graph"),           dir "grid" gridresponse,           dir "graph" graphresponse,           dir "image" graphimageresponse,           dir "timetable-image" $ "courses" >>= \x -> "session" >>= timetableimageresponse x,           dir "graph-fb" $ seeother redirecturlgraphemail $ toresponse "",           dir "post-fb" $ seeother redirecturlgraphpost $ toresponse "",           dir "test" $ "code" >>= getemail,           dir "test-post" $ "code" >>= posttofacebook,           dir "post" postresponse,           dir "draw" drawresponse,           dir "about" $ aboutresponse aboutcontents,           dir "privacy" $ privacyresponse privacycontents,           dir "static" $ servedirectory disablebrowsing [] staticdir,           dir "course" $ "name" >>= retrievecourse,           dir "all-courses" $ liftio allcourses,           dir "graphs" $ liftio querygraphs,           dir "course-info" $ "dept" >>= courseinfo,           dir "depts" $ liftio deptlist,           dir "timesearch" searchresponse,           dir "calendar" $ lookcookievalue "selected-lectures" >>= calendarresponse,           dir "get-json-data" $ "graphname" >>= \graphname -> liftio $ getgraphjson graphname,           dir "loading" $ "size" >>= loadingresponse,           dir "save-json" $ "jsondata" >>= \jsonstr -> "namedata" >>= \namestr -> liftio $ savegraphjson jsonstr namestr,           notfoundresponse     ] 

in list after function msum( assume it's list since it's in []), after dir route? should route in happstack code? totally lost in piece of code.

my understanding each dir ... line route (for directory.)

e.g.:

 dir "static" $ servedirectory disablebrowsing [] staticdir, 

means paths /static/... invoke handler servedirectory ...

if want add own route, add before notfoundresponse - otherwise never called.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo