mirror of
https://github.com/aantron/dream.git
synced 2025-12-31 00:03:52 -05:00
Tutorial
Dream's first several examples make up a tutorial. Each example is a
complete project with a helpful README, and plenty of links to next steps and
documentation. You can begin at 1-hello, or look in the
list below and jump to whatever interests you!
1-hello— the simplest Dream server responds to every request with the same friendly message.2-middleware— adds the first Dream middleware: the logger.3-router— different handlers for different paths.4-counter— the first custom middleware!5-echo— reads request bodies.6-template— renders responses from inline HTML templates and guards against XSS.7-debug— includes detailed information about errors in responses.8-error— customize all error responses in one place.9-log— writing messages to Dream's log.a-promise— introduces Lwt, the promise library used by Dream.b-session— associates state with client sessions.c-cookie— sets custom cookies.d-form— reading forms and CSRF prevention.e-jsonf-staticg-uploadh-sql— finally CRUD!i-graphqlj-streamk-websocketl-httpsm-crypton-locals
That's it for the tutorial!
Reason
There are several examples showing Dream with Reason syntax. They also use esy
package.json.
Extras
The rest of the examples cover additional topics in a more-standalone fashion. The goal of the examples is to cover the great majority of real-world HTTP usage, so that they make up a good survey. Please open an issue if something is missing!
Ideas:
w-auto-reloadw-fullstackw-index-htmlw-one-binaryw-ppx-derivingw-react-spaw-subcommandw-template-directoryw-tyxml
Basics:
Security:
w-authw-client-side-sessionw-corsw-database-sessionw-file-sessionw-form-expiredw-json-csrfw-jwtw-key-rotationw-upload-csrf
Techniques:
w-etagw-graphql-sqlw-graphql-subscriptionsw-https-redirectw-long-pollingw-postgres-dockerw-server-sent-eventsw-sql-streamw-template-streamw-websocket-stream
Advanced customization: