vif/examples/12-static/main.ml

19 lines
345 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
let open Vif.Content_type in
[ 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
;;