diff --git a/README.md b/README.md index 43ea723..30f0808 100644 --- a/README.md +++ b/README.md @@ -89,15 +89,16 @@ installed in your switch, you may have to remove them with `opam remove` to avoid conflicts. However, they should not be pulled into a basic build of Dream and most programs that use it. -After that, go to one of the examples, such as -[**`1-hello`**](https://github.com/aantron/dream/tree/master/example/1-hello#files), -and try building it: +After that, go to one of the examples, such as [**`1-hello`**][1-hello], and +try building it: ``` cd example/1-hello dune exec --root . ./hello.exe ``` +If you prefer Reason syntax, try example [**`r-hello`**][r-hello] instead. + You should be able to copy the example out to a completely separate directory, if you didn't use a local `_opam` switch scoped to Dream's clone directory. If you did, you can pin Dream to your clone in a different opam switch with @@ -115,13 +116,15 @@ opam pin add dream /path/to/your/clone and start wherever you like, or begin at [**`1-hello`**][1-hello], the Dream version of *Hello, world!* - [**Reason syntax**][reason-examples] — Several of the examples are - available in Reason syntax, with more to come over time! + available in Reason syntax. See [**`r-hello`**][r-hello]. + - [**Examples**][examples] — These cover various HTTP scenarios. - [**API reference**][api-main] [tutorial]: https://github.com/aantron/dream/tree/master/example#readme [examples]: https://github.com/aantron/dream/tree/master/example#examples [1-hello]: https://github.com/aantron/dream/tree/master/example/1-hello#files +[r-hello]: https://github.com/aantron/dream/tree/master/example/r-hello#files [reason-examples]: https://github.com/aantron/dream/tree/master/example#reason [api-main]: https://aantron.github.io/dream/#types diff --git a/example/README.md b/example/README.md index 3dc36f3..b214bd9 100644 --- a/example/README.md +++ b/example/README.md @@ -54,7 +54,7 @@ That's it for the tutorial! There are several examples showing Dream with Reason syntax. -- [**`r-hello`**](r-hello#files) +- [**`r-hello`**](r-hello#files)  —  the simplest Dream server. - [**`r-template`**](r-template#files) - [**`r-template-stream`**](r-template-stream#files) - `r-fullstack` diff --git a/example/r-hello/README.md b/example/r-hello/README.md index bd8787d..9394056 100644 --- a/example/r-hello/README.md +++ b/example/r-hello/README.md @@ -2,6 +2,32 @@
+This example shows the simplest Dream program one could write: + +```reason +let () = + Dream.run(_ => + Dream.respond("Good morning, reasonable world!")); +``` + +
$ dune exec --root . ./hello.exe
+08.04.21 13:55:56.552                       Running on http://localhost:8080
+08.04.21 13:55:56.553                       Press ENTER to stop
+
+
-[Up to the tutorial index](../#readme) +After starting it, visit [http://localhost:8080](http://localhost:8080), and it +will respond with its friendly greeting! + +
+ +**See also:** + +- [**`r-template`**](../r-template#files) shows templates with Reason syntax. +- [**`2-middleware`**](../2-middleware) introduces the *logger*, the most + commonly used Dream middleware. The example is in OCaml syntax. + +
+ +[Up to the example index](../#reason)