mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 03:05:29 -05:00
move echo from src/examples/ to examples/
This commit is contained in:
parent
89344f46f0
commit
c8982c8836
5 changed files with 15 additions and 6 deletions
2
echo.sh
2
echo.sh
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
exec dune exec "src/examples/echo.exe" -- $@
|
||||
exec dune exec "examples/echo.exe" -- $@
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@
|
|||
(modules sse_client)
|
||||
(libraries unix))
|
||||
|
||||
(executable
|
||||
(name echo)
|
||||
(flags :standard -warn-error -a+8)
|
||||
(modules echo)
|
||||
(libraries tiny_httpd tiny_httpd_camlzip))
|
||||
|
||||
(rule
|
||||
(targets test_output.txt)
|
||||
(deps (:script ./run_test.sh) ./sse_client.exe ./sse_server.exe)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,14 @@ let () =
|
|||
Unix.sleepf 0.1;
|
||||
done;
|
||||
);
|
||||
S.add_route_server_sent_handler server S.Route.(exact "count" @/ int @/ return)
|
||||
(fun n _req (module EV : S.SERVER_SENT_GENERATOR) ->
|
||||
for i=0 to n do
|
||||
EV.send_event ~data:(string_of_int i) ();
|
||||
Unix.sleepf 0.1;
|
||||
done;
|
||||
EV.close();
|
||||
);
|
||||
|
||||
Printf.printf "listening on http://localhost:%d/\n%!" (S.port server);
|
||||
match S.run server with
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
(executables
|
||||
(names echo)
|
||||
(flags :standard -warn-error -a+8)
|
||||
(libraries tiny_httpd tiny_httpd_camlzip))
|
||||
Loading…
Add table
Reference in a new issue