Last active
October 9, 2022 22:05
-
-
Save louislebrault/b5ecc9b5fc042a6c7e9bf6b8e2644b04 to your computer and use it in GitHub Desktop.
wai/warp server
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
start :: Context -> IO () | |
start ctx = do | |
let port = 3000 | |
Prelude.putStrLn $ "Listening on port " ++ show port | |
run port (app ctx) | |
app :: Context -> Application | |
app ctx req respond = | |
let | |
path = pathInfo req | |
method = requestMethod req | |
in | |
case (method, path) of | |
("GET", ["boards"]) -> do | |
result <- Board.getBoards ctx | |
respond $ ok (websiteOrigin ctx) result | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment