Compare commits
No commits in common. "73f68e201fc18d7694671a8fde02ad6f7439719b" and "4194ae6fda8a50530e9979e56c81827fb3e9f210" have entirely different histories.
73f68e201f
...
4194ae6fda
@ -1,24 +1,4 @@
|
||||
let count = ref 0
|
||||
|
||||
(* middleware *)
|
||||
let count_requests inner_handler request =
|
||||
count := !count + 1;
|
||||
inner_handler request
|
||||
|
||||
let () =
|
||||
Dream.run
|
||||
@@ Dream.logger
|
||||
@@ count_requests
|
||||
@@ Dream.router [
|
||||
Dream.get "/"
|
||||
(fun _ ->
|
||||
Dream.html "Hello, world!");
|
||||
|
||||
Dream.get "/count"
|
||||
(fun _ ->
|
||||
Dream.html (Printf.sprintf "Saw %i requests" !count));
|
||||
|
||||
Dream.get "/echo/:word"
|
||||
(fun request ->
|
||||
Dream.html (Dream.param request "word"));
|
||||
]
|
||||
@@ fun _ -> Dream.html "Good morning, world!"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user