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
— our content is now slightly dynamic!5-echo
6-template
— render responses from templates and guard against XSS.7-debug
— centralize your error page and run the debugger.8-error-page
9-logging
a-promise
b-session
c-cookie
d-form
— reading forms and CSRF prevention.e-json
f-static
g-upload
h-sql
— finally CRUD!i-graphql
j-streaming
k-websocket
l-https
m-crypto
n-locals
That's it for the tutorial!
Scroll down for everything else.
There are several examples of using Dream with Reason syntax:
The rest of the examples cover additional topics in a more-standalone fashion. They are, however, still complete, self-contained projects in the same style.
The goal of the examples is to cover the great majority of real-world HTTP usage, so that perusing them gives a good survey. Please open an issue if something is missing!
Ideas:
Basics:
Security:
w-auth
w-client-side-session
w-cors
w-database-session
w-file-session
w-form-expired
w-json-csrf
w-jwt
w-upload-csrf
Techniques:
w-etag
w-graphql-sql
w-graphql-subscriptions
w-https-redirect
w-long-polling
w-postgres-docker
w-server-sent-events
w-sql-streaming
w-template-streaming
w-websocket-streaming
Advanced customization: