package dream-httpaf

  1. Overview
  2. Docs
Internal: shared http/af stack for Dream (server) and Hyper (client)

Install

Dune Dependency

Authors

Maintainers

Sources

dream-1.0.0-alpha6.tar.gz
sha256=8d3b6344c0e175aca628b3d5bb8ee58265e8c1074fc2d40d63f136fef83daf90

Description

This package does not have a stable API.

Published: 28 May 2024

README

README.md

Dream

Easy-to-use, feature-complete Web framework without boilerplate.


Quick Start | Playground | Tutorial | Reference   



Dream is one flat module in one package, documented on one page, but with many examples. It offers:


...all without sacrificing ease of use — Dream has:


Every part of the API is arranged to be easy to understand, use, and remember. Dream sticks to base OCaml types like string and list, introducing only a few types of its own — and some of those are just abbreviations for bare functions!

The neat interface is not a limitation. Everything is still configurable by a large number of optional arguments, and very loose coupling. Where necessary, Dream exposes the lower-level machinery that it is composed from. For example, the basic body and WebSocket readers return strings, but you can also do zero-copy streaming.

You can even run Dream as a quite bare abstraction over its underlying set of HTTP libraries, where it acts only as minimal glue code between their slightly different interfaces.

And, even though Dream is presented as one package for ordinary usage, it is internally factored into several sub-libraries, according to the different dependencies of each, for fast porting to different environments.

Dream is a low-level and unopinionated framework, and you can swap out its conveniences. For example, you can use TyXML with server-side JSX instead of Dream's built-in templates. You can bundle assets into a single Dream binary, or use Dream in a subcommand. Dream tries to be as functional as possible, touching global runtime state only lazily, when called into.


Quick start

Visit one of the first tutorials in the online playground, and read its docs. You can get and build it locally with:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/aantron/dream/master/example/quickstart.sh)"

Most of the other examples are also loaded in the playground. See the links on its home page.

opam

Create a project directory with an optional local switch:

mkdir project
cd project
opam switch create . 5.1.0
eval $(opam env)

Install Dream:

opam install dream

After that, go to any of the examples, such as 2-middleware, re-create the files locally, and run it:

dune exec ./middleware.exe

esy

Visit any of the examples, such as 2-middleware, and re-create the files locally. The file esy.json shows how to depend on Dream. All of the examples are installed by running npx esy, and started with npx esy start.


Documentation


Recommended projects


Example repositories


Contact

Apart from the issues, good places to discuss Dream are...

Highlight @antron to poke @aantron specifically.


Contributing

All kinds of contributions are welcome, including examples, links to blogs, related libraries, and, of course, PRs! See CONTRIBUTING.md.

As an immediate note, if you'd like to clone the repo, be sure to use --recursive, because Dream uses several git submodules:

git clone https://github.com/aantron/dream.git --recursive

Acknowledgements

Dream is based on work by the authors and contributors of its many dependencies and their transitive dependencies. There are, however, several influences that cannot be discovered directly:

Dependencies (15)

  1. psq
  2. lwt_ssl >= "1.2.0"
  3. faraday-lwt-unix
  4. faraday >= "0.6.1"
  5. digestif >= "0.7.2"
  6. bigstringaf >= "0.5.0"
  7. base64 >= "3.0.0"
  8. angstrom >= "0.14.0"
  9. ssl >= "0.5.8"
  10. ocaml >= "4.08.0" & < "5.3"
  11. lwt_ssl
  12. lwt_ppx >= "1.2.2"
  13. lwt
  14. dune >= "2.7.0"
  15. dream-pure

Dev Dependencies

None

Used by (1)

  1. dream >= "1.0.0~alpha5" & < "1.0.0~alpha8"

Conflicts

None

OCaml

Innovation. Community. Security.