Eio HTTP server with static file serving and route handlers
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-respond: defer README example via let run ()

The block called [Eio_main.run] at top level (mdx executes it) and
referenced a non-existent [Respond.post_request_body]; the body is
just [req.body] on the [post_request] record. Wrap as [run () = ...]
and use the right field. Add [eio] / [eio.unix] to the mdx libs.

+12 -11
+11 -10
README.md
··· 28 28 ## Usage 29 29 30 30 ```ocaml 31 - Eio_main.run @@ fun env -> 32 - let routes = 33 - Respond.[ 34 - get "/api/health" (fun _req -> Response.json {|{"ok":true}|}); 35 - post "/api/echo" (fun req -> 36 - Response.text (Respond.post_request_body req)); 37 - ] 38 - in 39 - Respond.run ~net:(Eio.Stdenv.net env) ~port:8080 40 - ~root:(Eio.Stdenv.cwd env) routes 31 + let run () = 32 + Eio_main.run @@ fun env -> 33 + let routes = 34 + Respond. 35 + [ 36 + get "/api/health" (fun _req -> Response.json {|{"ok":true}|}); 37 + post "/api/echo" (fun req -> Response.text req.body); 38 + ] 39 + in 40 + Respond.run ~net:(Eio.Stdenv.net env) ~port:8080 ~root:(Eio.Stdenv.cwd env) 41 + routes 41 42 ``` 42 43 43 44 ## API Overview
+1 -1
dune
··· 4 4 5 5 (mdx 6 6 (files README.md) 7 - (libraries respond eio_main)) 7 + (libraries respond eio_main eio eio.unix))