vif/examples/12-static/main.ml

19 lines
334 B
OCaml
Raw Normal View History

2025-02-18 18:25:30 +00:00
#require "vif" ;;
open Vif ;;
2025-02-19 14:06:18 +00:00
let default req server _ =
Response.with_file ~compression:`DEFLATE req (Fpath.v "index.html")
;;
let routes =
let open Vif.U in
let open Vif.R in
2025-02-21 09:33:20 +00:00
let open Vif.T in
2025-02-19 14:06:18 +00:00
[ get (rel /?? nil) --> default ]
;;
2025-02-18 18:25:30 +00:00
let () = Miou_unix.run @@ fun () ->
2025-02-19 14:06:18 +00:00
Vif.run ~handlers:[ Handler.static ] routes ()
2025-02-18 18:25:30 +00:00
;;