Created
June 8, 2013 04:43
-
-
Save LeviSchuck/5734068 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
-- No hiding Route | |
import Yesod as Import | |
-- ... | |
--Assumes that "App" is your context | |
type RouteRenderer = (Route App -> Text) |
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
getAPIR :: Handler TypedContent | |
getAPIR = do | |
render <- getUrlRender | |
selectRep $ do | |
provideRep $ returnJson $ getAPIJson render | |
getAPIJson :: RouteRenderer -> Value | |
getAPIJson render = object $ ([ | |
"auth_url" .= render HomeR, | |
"potato" .= ("Apples"::Text), | |
"eggs" .= object ([ | |
"happy" .= (32.4::Double) | |
]), | |
"chocolate" .= object ([ | |
"hello" .= True, | |
"nest" .= object ([ | |
"things" .= render APIUsersR | |
]) | |
]) | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment