Skip to content

Commit 80a4dc3

Browse files
committed
doc: update readme
1 parent 6e54ee6 commit 80a4dc3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
# Tiny_httpd [![build status](https://travis-ci.org/c-cube/tiny_httpd.svg?branch=master)](https://travis-ci.org/c-cube/tiny_httpd) [![build](https://github.com/c-cube/tiny_httpd/workflows/build/badge.svg)](https://github.com/c-cube/tiny_httpd/actions)
33

4-
Minimal HTTP server using good old threads and `Scanf` for routing.
4+
Minimal HTTP server using good old threads, with stream abstractions,
5+
simple routing, URL encoding/decoding, and optional compression with camlzip.
56

67
Free from all forms of `ppx`, async monads, etc.
78

@@ -17,10 +18,12 @@ module S = Tiny_httpd
1718
let () =
1819
let server = S.create () in
1920
(* say hello *)
20-
S.add_path_handler ~meth:`GET server
21-
"/hello/%s@/" (fun name _req -> S.Response.make_ok ("hello " ^name ^"!\n"));
21+
S.add_route_handler ~meth:`GET server
22+
S.Route.(exact "hello" @/ string @/ return)
23+
(fun name _req -> S.Response.make_ok ("hello " ^name ^"!\n"));
2224
(* echo request *)
23-
S.add_path_handler server
25+
S.add_route_handler server
26+
S.Route.(exact "echo" @/ return)
2427
"/echo" (fun req -> S.Response.make_ok (Format.asprintf "echo:@ %a@." S.Request.pp req));
2528
Printf.printf "listening on http://%s:%d\n%!" (S.addr server) (S.port server);
2629
match S.run server with

0 commit comments

Comments
 (0)