aboutsummaryrefslogtreecommitdiff
path: root/bin/client.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2025-06-01 17:12:06 +0200
committerSébastien Dailly <sebastien@dailly.me>2025-06-14 10:58:01 +0200
commit2f18b8a33cabd0ea666781ba048d0174b4dc5031 (patch)
treeaacda421b89e8133e3c73942e9ede61283a5005c /bin/client.ml
Initial commit
Diffstat (limited to 'bin/client.ml')
-rw-r--r--bin/client.ml23
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