This project provides an Inertia.js adapter for the Dream web framework for OCaml. It allows you to build modern single-page applications with server-side routing and controllers, while using a JavaScript-powered frontend.
To use the library in your project, add it to your dune file:
(libraries dream_inertia)Then, initialize the Inertia driver and add the middleware to your Dream application:
let () =
let root_view = Inertia.Helper.root_view ~js:"/assets/main.js" ~css:"/assets/main.css" in
Dream.run
@@ Dream.logger
@@ Dream.memory_sessions
@@ Dream.flash
@@ Inertia.middleware ~version:"1.0.0" ~root_view ()
@@ Dream.router [ (* your routes *) ]This project includes a full-stack example application that demonstrates how to use the library. The backend is built with Dream and the frontend is built with Vue.js and Vite.
-
Install dependencies:
opam install . --deps-only cd example npm install
-
Build and run the application:
cd example npm run build dune exec ./src/bin/main.exe
The application will be available at http://localhost:8080.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE.md file for details.