diff options
Diffstat (limited to 'bin/client.ml')
-rw-r--r-- | bin/client.ml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/client.ml b/bin/client.ml new file mode 100644 index 0000000..17284e1 --- /dev/null +++ b/bin/client.ml @@ -0,0 +1,23 @@ +open Lwt.Syntax + +let root = "http://[::1]:8080" + +let request = + let* result = + Cohttp_handler.request ~root + (module Services_impl.Nb_car) + () { value = "foobar" } + in + match result with + | Error code -> + prerr_endline ("Got code " ^ code); + Lwt.return_unit + | Ok { value; nbcar } -> + print_endline + (String.concat " " + [ + "The number of characters for"; value; "is"; Int64.to_string nbcar; + ]); + Lwt.return_unit + +let _ = Lwt_main.run request |