diff --git a/.ocamlformat b/.ocamlformat new file mode 100644 index 0000000..b24f4b1 --- /dev/null +++ b/.ocamlformat @@ -0,0 +1,2 @@ +profile = default +version = 0.28.1 \ No newline at end of file diff --git a/bin/dune b/bin/dune index 671f1df..1fe40dd 100644 --- a/bin/dune +++ b/bin/dune @@ -1,4 +1,4 @@ (executable (public_name chess-scribe-api) (name main) - (libraries chess_scribe_api)) + (libraries chess_scribe_api dream)) diff --git a/bin/main.ml b/bin/main.ml index 7bf6048..9234fa1 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1 +1,8 @@ -let () = print_endline "Hello, World!" +let () = + Dream.run @@ Dream.logger + @@ Dream.router + [ + Dream.get "/" (fun _ -> Dream.html "API Docs"); + Dream.get "/health" (fun _ -> Dream.html "Health Check"); + Dream.get "/pdf" (fun _ -> Dream.html "Generate PDF"); + ] diff --git a/chess-scribe-api.opam b/chess-scribe-api.opam index e69de29..1f0e021 100644 --- a/chess-scribe-api.opam +++ b/chess-scribe-api.opam @@ -0,0 +1,34 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "API for chess-scribe.org" +description: + "The backend that powers chess-scribe.org. Convert chess PGN files into PDFs." +maintainer: ["Owen Rees "] +authors: ["Owen Rees"] +license: "AGPLv3" +tags: ["chess" "pgn" "pdf"] +homepage: "https://github.com/therealowenrees/chess-scribe-api" +doc: "https://url/to/documentation" +bug-reports: "https://github.com/therealowenrees/chess-scribe-api/issues" +depends: [ + "dune" {>= "3.21"} + "ocaml" + "dream" {>= "1.0.0~alpha8"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/therealowenrees/chess-scribe-api.git" +x-maintenance-intent: ["(latest)"] diff --git a/dune-project b/dune-project index 9f841f1..32d4ca0 100644 --- a/dune-project +++ b/dune-project @@ -17,9 +17,13 @@ (package (name chess-scribe-api) - (synopsis "A short synopsis") - (description "A longer description") - (depends ocaml) + (synopsis "API for chess-scribe.org") + (description + "The backend that powers chess-scribe.org. Convert chess PGN files into PDFs.") + (depends + ocaml + (dream + (>= "1.0.0~alpha8"))) (tags ("chess" "pgn" "pdf")))