Working basic htmx page and endpoint, WIP static file serving and dune test running
This commit is contained in:
@@ -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)))
|
||||
Executable
+19
@@ -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
|
||||
Reference in New Issue
Block a user