Skip to content

Commit e563fec

Browse files
committed
update readme
1 parent 3aa056e commit e563fec

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# ocaml_webapp
2-
A minimal example of a lightweight webapp in OCaml
2+
3+
A minimal example of a lightweight webapp in OCaml.
4+
5+
It features a possible organization of files to maximize code sharing between server (native OCaml) and client (BuckleScript). Some of the things shared are:
6+
7+
- React components, which are server-side rendered with [Tyxml](https://github.com/ocsigen/tyxml) and hydrated with [ReasonReact](https://reasonml.github.io/reason-react/)
8+
- Routes, through the OCaml library [Routes](https://github.com/anuragsoni/routes).
9+
- API endpoints interface types, through library [ATD](https://github.com/ahrefs/atd), that also generates encoders / decoders automatically.
10+
11+
Potentially, `shared` folder can contain other shared code like validation functions, data processing, etc.
312

413
### Getting started
514

@@ -21,13 +30,21 @@ Install all dependencies:
2130
make deps
2231
```
2332

24-
Run the server:
33+
Build client:
34+
35+
```
36+
yarn webpack:dev
37+
```
38+
39+
Build and run the server:
2540
```bash
2641
make run
2742
```
2843

2944
Open the browser and go to http://localhost:3000/.
3045

46+
It's also possible to get hot reloading while developing. For that, start the server (to be able to serve API requests) with `make run`, run BuckleScript in `yarn start` and then start Webpack dev server with `yarn server`.
47+
3148
### Run databases locally
3249

3350
```

server/lib/handlers.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open Lwt.Syntax
77
let default_head =
88
let open Html in
99
head
10-
(title (txt "OCaml Webapp Tutorial"))
10+
(title (txt "OCaml Webapp"))
1111
[
1212
meta ~a:[ a_charset "UTF-8" ] ();
1313
meta

0 commit comments

Comments
 (0)