Package

purescript-makkori

Repository
justinwoo/purescript-makkori
License
MIT
Uploaded by
justinwoo
Published on
2018-03-09

Build Status

Simple bindings to Express made for easy interop.

This is an incomplete library. If you find that something is missing, make some FFI/coerced functions to work with and make some issues or PRs. Or make your own library, that's fine too.

Example

main = do
  app <- M.makeApp
  server <- M.listen (M.Port 9999) mempty app
  json <- M.makeJSONMiddleware {}
  M.use (M.Path "/") json app
  M.get
    (M.Path "/get-test")
    (M.makeHandler (\_ res -> M.sendResponse "GET OK" res))
    app
  M.post
    (M.Path "/post-test")
    (M.makeHandler
      (\req res -> do
	  body <- (readString <=< readProp "a") <$> M.getBody req
	  M.sendResponse "POST OK" res))
    app

  M.close mempty server