Skip to content

Instantly share code, notes, and snippets.

@metametaclass
Created October 12, 2012 13:49
Show Gist options
  • Save metametaclass/3879280 to your computer and use it in GitHub Desktop.
Save metametaclass/3879280 to your computer and use it in GitHub Desktop.
listEntity :: AppRoot -> String -> MyServerPartT Response
listEntity r w =
methodM [GET, POST] >> do
decodeBody reqPolicy
auth r w
AppState { dbCtx = ctx } <- ask
withData $ handle ctx w
where handle ctx t (TestGet p) =
do
rs <- liftIO $ doSelectFromTable ctx t (filtParams ctx t p)
case rs of
Right x -> do -- liftIO $ putStrLn x
qq <- xsltIf (Just "test.xsl") x
-- liftIO $ putStrLn qq
ok $ contentTypeHtml $ toResponse qq
Left _ -> do liftIO $ errorM appLog dbError
badRequest $ contentTypeXml $ toResponse dbError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment