Working basic htmx page and endpoint, WIP static file serving and dune test running

This commit is contained in:
2024-10-31 12:10:38 -06:00
commit d18ae43731
21 changed files with 533 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
(library
(name stack_picker_scripts)
(inline_tests)
(libraries
eio_main
caqti-eio.unix
caqti-driver-sqlite3
cohttp-eio
tyxml
fmt
unix
logs.fmt
logs.threaded)
(preprocess
(pps ppx_assert ppx_inline_test tyxml-ppx)))
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env ocaml
let rec find_html_files (static_path : string) =
let files = Sys.readdir static_path in
Array.fold_left
(fun acc file ->
let path = Filename.concat static_path file in
if Sys.is_directory path then acc @ find_html_files path
else if Filename.check_suffix path ".html" then path :: acc
else acc)
[] files
let () =
let files = find_html_files "static" in
let _file_names = List.fold_left (fun name acc ->
acc ^ "\n - " ^ name
) "" files in
(* Printf.printf "Found files:\n%s" file_names; *)
exit 0