mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 03:05:29 -05:00
echo_eio: make quit into a button, to use POST
This commit is contained in:
parent
55ef988aa4
commit
d2b89eee50
1 changed files with 14 additions and 6 deletions
|
|
@ -120,9 +120,9 @@ let () =
|
||||||
(* stats *)
|
(* stats *)
|
||||||
S.add_route_handler server
|
S.add_route_handler server
|
||||||
S.Route.(exact "stats" @/ return)
|
S.Route.(exact "stats" @/ return)
|
||||||
(fun _req ->
|
(fun _req ->
|
||||||
let stats = get_stats () in
|
let stats = get_stats () in
|
||||||
S.Response.make_string @@ Ok stats);
|
S.Response.make_string @@ Ok stats);
|
||||||
|
|
||||||
S.add_route_handler server ~meth:`POST
|
S.add_route_handler server ~meth:`POST
|
||||||
S.Route.(exact "quit" @/ return)
|
S.Route.(exact "quit" @/ return)
|
||||||
|
|
@ -183,11 +183,19 @@ let () =
|
||||||
];
|
];
|
||||||
li []
|
li []
|
||||||
[
|
[
|
||||||
pre []
|
pre
|
||||||
|
[ A.style "display: inline" ]
|
||||||
[
|
[
|
||||||
a [ A.href "/quit/" ] [ txt "/quit (POST)" ];
|
a [ A.href "/quit" ] [ txt "/quit" ];
|
||||||
txt " have the server stop";
|
txt " (POST) to stop server";
|
||||||
];
|
];
|
||||||
|
form
|
||||||
|
[
|
||||||
|
A.style "display: inline";
|
||||||
|
A.action "/quit";
|
||||||
|
A.method_ "POST";
|
||||||
|
]
|
||||||
|
[ button [ A.type_ "submit" ] [ txt "quit" ] ];
|
||||||
];
|
];
|
||||||
];
|
];
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue