Movatterモバイル変換


[0]ホーム

URL:


packagedream

  1. Overview
  2. Docs

You can search for identifiers within the package.

in-package search v0.2.0

Tidy, feature-complete Web framework

Install

Dune Dependency

Authors

Maintainers

Sources

dream-1.0.0-alpha2.tar.gz
sha256=bf19c13f0da7e01cc30b8dfaa1fca1dc8b44a06fb6e0eef56d56513952b9bb01
md5=1220f17530522e488653eb91115867e3

Description

Dream is a feature-complete Web framework with a simple programmingmodel and no boilerplate. It provides only two data types, request andresponse.

Almost everything else is either a built-in OCaml type, or anabbreviation for a bare function. For example, a Web app, known inDream as a handler, is just an ordinary function from requests toresponses. And a middleware is then just a function from handlers tohandlers.

Within this model, Dream adds:

  • Session management with pluggable back ends.
  • A fully composable router.
  • Support for HTTP/1.1, HTTP/2, and HTTPS.
  • WebSockets.
  • GraphQL, including subscriptions and a built-in GraphiQL editor.
  • SQL connection pool helpers.
  • Server-side HTML templates.
  • Automatic secure handling of cookies and forms.
  • Unified, internationalization-friendly error handling.
  • A neat log, and OCaml runtime configuration.
  • Helpers for Web formats, such as Base64url, and a modern cipher.

Because of the simple programming model, everything is optional andcomposable. It is trivailly possible to strip Dream down to just abare driver of the various HTTP protocols.

Dream is presented as a single module, whose API is documented on onepage. In addition, Dream comes with a large number of examples.Security topics are introduced throughout, wherever they areapplicable.

README

README.md

Dream

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


Quick Start |Playground | Tutorial |Reference   



Dream isone flat module inone package, documented onone page, but withmany 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 likestring andlist, introducing only a fewtypes 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 readersreturn strings, but you can also dozero-copy streaming.

You can even run Dream as aquite bare abstraction over itsunderlying 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 intoseveral 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 withserver-side JSX instead of Dream's built-in templates. You can bundle assets into asingle 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


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

This downloads and runsquickstart.sh, which does a sandboxed build of one of the firsttutorials,2-middleware. It's mostly the same as:

git clone https://github.com/aantron/dream.git --recursivecd dream/example/2-middlewarenpm install esy && npx esynpx esy start

Knowing that, you can start from any otherexample. All of them include their own build commands. They don't have to be subdirectories ofdream — you can copy them out to start your own project directory. Especially consider starting with thefull-stack examples, which build both a Dream server and a JavaScript client.

opam

opam install dream

After that, go to one of the examples, such as1-hello, and build it:

cd example/1-hellodune exec --root . ./hello.exe

Playground

Most of the examples are loaded into theplayground. For instance,2-middleware is athttp://dream.as/2-middleware.


Documentation


Contributing

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

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

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

Acknowledgements

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

Dependencies (31)

  1. result
  2. psq
  3. faraday-lwt-unix
  4. faraday>= "0.6.1"
  5. digestif>= "0.7.2"
  6. bigstringaf>= "0.5.0"
  7. angstrom>= "0.14.0"
  8. yojson
  9. uri>= "4.2.0"
  10. ocaml>= "4.08.0" & < "5.0"
  11. multipart_form>= "0.3.0" & < "0.4.0"
  12. mirage-crypto-rng>= "0.8.0" & < "0.11.0"
  13. mirage-crypto>= "0.8.1" & < "1.0.0"
  14. magic-mime
  15. logs>= "0.5.0"
  16. ssl>= "0.5.8"
  17. lwt_ssl
  18. lwt_ppx>= "1.2.2"
  19. lwt
  20. hmap
  21. graphql-lwt
  22. graphql_parser
  23. fmt>= "0.8.7"
  24. dune>= "2.7.0"
  25. cstruct>= "6.0.0"
  26. conf-libevos != "win32"
  27. caqti-lwt
  28. caqti>= "1.4.0" & < "2.0.0~"
  29. bigarray-compat
  30. base64>= "3.1.0"
  31. base-unix

Dev Dependencies (11)

  1. tyxml-ppxwith-test & >= "4.5.0"
  2. tyxml-jsxwith-test & >= "4.5.0"
  3. tyxmlwith-test & >= "4.5.0"
  4. reasonwith-test
  5. ppx_yojson_convwith-test
  6. ppx_expectwith-test
  7. lambdasoupwith-test
  8. crunchwith-test
  9. caqti-driver-sqlite3with-test
  10. bisect_ppxwith-test & >= "2.5.0"
  11. alcotestwith-test

Conflicts (1)

  1. tls>= "0.15.0"

[8]ページ先頭

©2009-2025 Movatter.jp