diff options
Diffstat (limited to 'bin/main.ml')
-rw-r--r-- | bin/main.ml | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/bin/main.ml b/bin/main.ml index 7bf6048..7e537a7 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1 +1,26 @@ -let () = print_endline "Hello, World!" +[@@@warning "-26-27-32"] + +open! StdLabels +open Eio +open Piaf + +let request_handler Server.{ request; _ } = + match Rinha.Router.match_route request.meth request.target with + | Some handler -> handler request + | None -> Response.create `Not_found +;; + +let () = + Eio_main.run + @@ fun env -> + Switch.run + @@ fun sw -> + let config = + let interface = Net.Ipaddr.V4.any in + let port = 3000 in + `Tcp (interface, port) + in + let config = Server.Config.create config in + let server = Server.create ~config request_handler in + ignore @@ Server.Command.start ~sw env server +;; |