Created
June 15, 2010 18:53
-
-
Save jacobstanley/439519 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
site :: MVar SimState -> Snap () | |
site sim = catch500 $ | |
ifTop (fileServe "static/index.html") | |
<|> route [ ("vessel/speed/:speed", method PUT putSpeed sim) | |
, ("vessel", method GET getSim sim) | |
] | |
<|> fileServe "static" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- putSpeed :: MVar SimState -> Snap () | |
-- getSim :: MVar SimState -> Snap () | |
site :: MVar SimState -> Snap () | |
site sim = catch500 $ | |
ifTop (fileServe "static/index.html") | |
<|> routeWith sim [ ("vessel/speed/:speed", method PUT <$> putSpeed) | |
, ("vessel", method GET <$> getSim) | |
] | |
<|> fileServe "static" | |
routeWith :: a -> [(ByteString, a -> Snap ())] -> Snap () | |
routeWith a = route . map f | |
where | |
f (r, h) = (r, h a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment