mirror of
https://github.com/aantron/dream.git
synced 2025-11-13 00:05:35 -05:00
1-hello
This project is so simple that it doesn't even log requests!
let () =
Dream.run (fun _ ->
Dream.respond "Good morning, world!")
It's the absolute minimum Dream server. It responds to all requests with the same text. At startup, it prints a message to the log, telling you where to point your browser. The link is clickable in many terminals.
$ dune exec --root . ./hello.exe
08.03.21 21:17:21.471 Running on http://localhost:8080
08.03.21 21:17:21.471 Press ENTER to stop
If you go to http://localhost:8080, you will, of
course, see Good morning, world!.
Next steps:
- The next example,
2-middleware, adds a logger to the app. 3-routersends requests to different handlers, depending on their path.