This is a simple example of a blog application using the Model-View-Controller (MVC) design pattern in OCaml.
To run the application, you need to have OCaml installed on your machine. You can download OCaml from the official website.
After installing OCaml, you can run the following commands to build and run the application:
Note: Environment variables
DATABASE_URImust be set to connect to a PostgreSQL database.
opam install . --deps-only --yes
dune build --profile=release
dune exec src/main.exe
open http://localhost:3000-
Server: Dream
Dream is a web framework for OCaml that is designed to be easy to use, fast, and secure.
-
SQL: Caqti
-
Templating:
Html_of_jsxHtml_of_jsxis a library to convert JSX to HTML in OCaml. See views for examples.
src/Main.ml: The entry point of the application.src/controllers: Contains the controllers for the application.src/models: Contains the models interacting with the database.src/views: Contains the views for the application.src/types: Contains the types for the application.
This project is licensed under the MIT License - see the LICENSE file for details.