Skip to content

Instantly share code, notes, and snippets.

@louislebrault
Last active October 9, 2022 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save louislebrault/b5ecc9b5fc042a6c7e9bf6b8e2644b04 to your computer and use it in GitHub Desktop.
Save louislebrault/b5ecc9b5fc042a6c7e9bf6b8e2644b04 to your computer and use it in GitHub Desktop.
wai/warp server
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