Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed anchor in the rest files #361

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,40 @@ Dream binary][one-binary], or use Dream in a subcommand. Dream tries to be as
functional as possible, touching global runtime state only lazily, when called
into.

[https]: https://github.com/aantron/dream/tree/master/example/l-https#files
[websocket]: https://github.com/aantron/dream/tree/master/example/k-websocket#files
[graphql]: https://github.com/aantron/dream/tree/master/example/w-graphql-subscription#files
[templates]: https://github.com/aantron/dream/tree/master/example/7-template#files
[reason-templates]: https://github.com/aantron/dream/tree/master/example/r-template#files
[middleware]: https://github.com/aantron/dream/tree/master/example/2-middleware#files
[https]: https://github.com/aantron/dream/tree/master/example/l-https#folders-and-files
[websocket]: https://github.com/aantron/dream/tree/master/example/k-websocket#folders-and-files
[graphql]: https://github.com/aantron/dream/tree/master/example/w-graphql-subscription#folders-and-files
[templates]: https://github.com/aantron/dream/tree/master/example/7-template#folders-and-files
[reason-templates]: https://github.com/aantron/dream/tree/master/example/r-template#folders-and-files
[middleware]: https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files
[handler]: https://aantron.github.io/dream/#type-handler
[routing]: https://github.com/aantron/dream/tree/master/example/3-router#files
[routing]: https://github.com/aantron/dream/tree/master/example/3-router#folders-and-files
[cookies]: https://aantron.github.io/dream/#cookies
[forms]: https://aantron.github.io/dream/#forms
[sessions]: https://github.com/aantron/dream/tree/master/example/b-session#files
[sessions]: https://github.com/aantron/dream/tree/master/example/b-session#folders-and-files
[back-ends]: https://aantron.github.io/dream/#back-ends
[errors]: https://github.com/aantron/dream/tree/master/example/9-error#files
[errors]: https://github.com/aantron/dream/tree/master/example/9-error#folders-and-files
[crypto]: https://aantron.github.io/dream/#cryptography
[logging]: https://github.com/aantron/dream/tree/master/example/2-middleware#files
[melange]: https://github.com/aantron/dream/tree/master/example/r-fullstack-melange#files
[rescript]: https://github.com/aantron/dream/tree/master/example/w-fullstack-rescript#files
[jsoo]: https://github.com/aantron/dream/tree/master/example/w-fullstack-jsoo#files
[logging]: https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files
[melange]: https://github.com/aantron/dream/tree/master/example/r-fullstack-melange#folders-and-files
[rescript]: https://github.com/aantron/dream/tree/master/example/w-fullstack-rescript#folders-and-files
[jsoo]: https://github.com/aantron/dream/tree/master/example/w-fullstack-jsoo#folders-and-files
[types]: https://aantron.github.io/dream/#types
[basic-read]: https://aantron.github.io/dream/#val-body
[streaming]: https://aantron.github.io/dream/#streaming
[raw]: https://aantron.github.io/dream/#builtin
[alpn]: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation
[libs]: https://github.com/aantron/dream/tree/master/src
[deploy]: https://github.com/aantron/dream/tree/master/example#deploying
[jsx]: https://github.com/aantron/dream/tree/master/example/r-tyxml#files
[one-binary]: https://github.com/aantron/dream/tree/master/example/w-one-binary#files
[jsx]: https://github.com/aantron/dream/tree/master/example/r-tyxml#folders-and-files
[one-binary]: https://github.com/aantron/dream/tree/master/example/w-one-binary#folders-and-files

<br>

## Quick start

You can get
[one](https://github.com/aantron/dream/tree/master/example/2-middleware#files)
[one](https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files)
of the first [tutorials][tutorial] and build it locally with:

<pre><b>bash -c "$(curl -fsSL https://raw.githubusercontent.com/aantron/dream/master/example/quickstart.sh)"</b></pre>
Expand Down Expand Up @@ -139,10 +139,10 @@ After that, go to any of the [examples][tutorial], such as
dune exec ./middleware.exe
```

[esy-example]: https://github.com/aantron/dream/tree/master/example/w-esy#files
[esy-example]: https://github.com/aantron/dream/tree/master/example/w-esy#folders-and-files
[quickstart.sh]: https://github.com/aantron/dream/blob/master/example/quickstart.sh
[esy]: https://esy.sh/
[2-middleware]: https://github.com/aantron/dream/tree/master/example/2-middleware#files
[2-middleware]: https://github.com/aantron/dream/tree/master/example/2-middleware#folders-and-files

## esy

Expand Down Expand Up @@ -173,14 +173,14 @@ esy`, and started with `npx esy start`.

[tutorial]: https://github.com/aantron/dream/tree/master/example#readme
[examples]: https://github.com/aantron/dream/tree/master/example#examples
[1-hello]: https://github.com/aantron/dream/tree/master/example/1-hello#files
[r-hello]: https://github.com/aantron/dream/tree/master/example/r-hello#files
[1-hello]: https://github.com/aantron/dream/tree/master/example/1-hello#folders-and-files
[r-hello]: https://github.com/aantron/dream/tree/master/example/r-hello#folders-and-files
[reason-examples]: https://github.com/aantron/dream/tree/master/example#reason
[deploying]: https://github.com/aantron/dream/tree/master/example#deploying
[api-main]: https://aantron.github.io/dream/#types
[fullstack]: https://github.com/aantron/dream/tree/master/example#full-stack
[watch]: https://github.com/aantron/dream/tree/master/example/w-watch#files
[reload]: https://github.com/aantron/dream/tree/master/example/w-live-reload#files
[watch]: https://github.com/aantron/dream/tree/master/example/w-watch#folders-and-files
[reload]: https://github.com/aantron/dream/tree/master/example/w-live-reload#folders-and-files

<br>

Expand Down
2 changes: 1 addition & 1 deletion docs/web/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ <h6>Tidy Web framework for OCaml and ReasonML</h6>
<li>
A <a target="_blank" rel="noreferrer noopener" href="https://github.com/aantron/dream/tree/master/example#readme">
Tutorial</a> &mdash; get started at
<a target="_blank" rel="noreferrer noopener" href="https://github.com/aantron/dream/tree/master/example/1-hello#files">
<a target="_blank" rel="noreferrer noopener" href="https://github.com/aantron/dream/tree/master/example/1-hello#folders-and-files">
<code>1-hello</code></a>!
</li>
<li>
Expand Down
8 changes: 4 additions & 4 deletions example/1-hello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ name of the `.ml` file, but with `.ml` changed to `.exe`.

**Next steps:**

- The next example, [**`2-middleware`**](../2-middleware#files), adds a logger
- The next example, [**`2-middleware`**](../2-middleware#folders-and-files), adds a logger
to the app.
- [**`3-router`**](../3-router#files) sends requests to different handlers,
- [**`3-router`**](../3-router#folders-and-files) sends requests to different handlers,
depending on their path.

<br>

**See also:**

- [**`r-hello`**](../r-hello#files) is a Reason syntax version of this example.
- [**`w-watch`**](../w-watch#files) sets up a development watcher.
- [**`r-hello`**](../r-hello#folders-and-files) is a Reason syntax version of this example.
- [**`w-watch`**](../w-watch#folders-and-files) sets up a development watcher.


<br>
Expand Down
16 changes: 8 additions & 8 deletions example/2-middleware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

*Middleware* is just functions that take handlers and wrap them, producing
bigger handlers that do a little bit more. This example takes the handler from
[**`1-hello`**](../1-hello#files) and wraps it in one of the most useful
[**`1-hello`**](../1-hello#folders-and-files) and wraps it in one of the most useful
middlewares, the [*logger*](https://aantron.github.io/dream/#val-logger):

```ocaml
Expand Down Expand Up @@ -40,22 +40,22 @@ When you run this server and visit

You can write your own messages to the log using
[`Dream.log`](https://aantron.github.io/dream/#val-log). See example
[**`a-log`**](../a-log#files) for more logging options. Now that we have the
[**`a-log`**](../a-log#folders-and-files) for more logging options. Now that we have the
logger, we will use it in all other examples, even though it's not really
necessary &mdash; it just makes it much easier to see what is going on.

<br>

There's not much else to middlewares &mdash; they are really just functions
from handlers to handlers, so you can create them anywhere. Example
[**`4-counter`**](../4-counter#files) already shows a simple custom middleware.
[**`4-counter`**](../4-counter#folders-and-files) already shows a simple custom middleware.

<!--
There are also more complicated middlewares defined in

- [**`m-locals`**](../m-locals/#files),
- [**`w-auto-reload`**](../w-auto-reload/#files), and
- [**`w-index-html`**](../w-index-html/#files).
- [**`m-locals`**](../m-locals#folders-and-files),
- [**`w-auto-reload`**](../w-auto-reload#folders-and-files), and
- [**`w-index-html`**](../w-index-html#folders-and-files).
-->

<!-- TODO Fill out this list; probably a-promise belongs here. -->
Expand All @@ -64,10 +64,10 @@ There are also more complicated middlewares defined in

**Next steps:**

- The next example, [**`3-router`**](../3-router#files), shows
- The next example, [**`3-router`**](../3-router#folders-and-files), shows
[*routes*](https://aantron.github.io/dream/#routing), the other way to build
up handlers in Dream.
- [**`4-counter`**](../4-counter#files) builds the first custom middleware.
- [**`4-counter`**](../4-counter#folders-and-files) builds the first custom middleware.

<br>

Expand Down
12 changes: 6 additions & 6 deletions example/3-router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,30 @@ The syntax `:word` in a route creates a path parameter, which can be read with
When none of the routes match, the router returns a `404 Not Found` response.
Except for the status code, the `404 Not Found` response is *completely* empty,
so it might not display well in your browser. In example
[**`9-error`**](../9-error#files), we will decorate all error responses with
[**`9-error`**](../9-error#folders-and-files), we will decorate all error responses with
an error template in one central location.

<br>

The router can do more than match simple routes:

- [**`f-static`**](../f-static#files) forwards all requests with a certain
- [**`f-static`**](../f-static#folders-and-files) forwards all requests with a certain
prefix to a static file handler.


<!-- - [**`w-scope`**](../w-scope/#files) applies middlewares to groups of routes
<!-- - [**`w-scope`**](../w-scope#folders-and-files) applies middlewares to groups of routes
&mdash; but only when they match.
- [**`w-subsite`**](../w-subsite/#files) attaches a handler as a complete,
- [**`w-subsite`**](../w-subsite#folders-and-files) attaches a handler as a complete,
nested sub-site, which might have its own router. -->
<!-- TODO -->

<br>

**Next steps:**

- [**`4-counter`**](../4-counter#files) counts requests, and exposes a route for
- [**`4-counter`**](../4-counter#folders-and-files) counts requests, and exposes a route for
getting the count.
- [**`5-promise`**](../5-promise#files) introduces
- [**`5-promise`**](../5-promise#folders-and-files) introduces
[Lwt](https://github.com/ocsigen/lwt), the promise library used by Dream.

<br>
Expand Down
6 changes: 3 additions & 3 deletions example/4-counter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ which means they usually also
This example's middleware only does something *before* calling the
`inner_handler`. To do something *after*, we will need to await the response
promise with [Lwt](https://github.com/ocsigen/lwt#readme), the promise library
used by Dream. The next example, [**`5-promise`**](../5-promise#files), does
used by Dream. The next example, [**`5-promise`**](../5-promise#folders-and-files), does
exactly that!

<br>

**Next steps:**

- [**`5-promise`**](../5-promise#files) shows a middleware that awaits
- [**`5-promise`**](../5-promise#folders-and-files) shows a middleware that awaits
responses using [Lwt](https://github.com/ocsigen/lwt).
- [**`6-echo`**](../6-echo#files) responds to `POST` requests and reads their
- [**`6-echo`**](../6-echo#folders-and-files) responds to `POST` requests and reads their
bodies.

<br>
Expand Down
6 changes: 3 additions & 3 deletions example/5-promise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<br>

[**`4-counter`**](../4-counter#files) was limited to counting requests *before*
[**`4-counter`**](../4-counter#folders-and-files) was limited to counting requests *before*
passing them on to the rest of the app. With the promise library
[Lwt](https://github.com/ocsigen/lwt), we can await responses, and do something
*after*. In this example, we separately count requests that were handled
Expand Down Expand Up @@ -91,8 +91,8 @@ We will stick to `let%lwt` in the examples and keep things tidy.

**Next steps:**

- [**`6-echo`**](../6-echo#files) uses Dream and Lwt to read a request body.
- [**`7-template`**](../7-template#files) shows how to interleave HTML and
- [**`6-echo`**](../6-echo#folders-and-files) uses Dream and Lwt to read a request body.
- [**`7-template`**](../7-template#folders-and-files) shows how to interleave HTML and
OCaml.

<br>
Expand Down
14 changes: 7 additions & 7 deletions example/6-echo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ foo
We usually want to do something more interesting with the request body than just
echo it, and there are several examples for that!

- [**`d-form`**](../d-form#files) parses request bodies as forms.
- [**`e-json`**](../e-json#files) parses bodies as JSON.
- [**`g-upload`**](../g-upload#files) receives file upload forms.
- [**`i-graphql`**](../i-graphql#files) receives GraphQL queries.
- [**`j-stream`**](../j-stream#files) streams huge bodies.
- [**`d-form`**](../d-form#folders-and-files) parses request bodies as forms.
- [**`e-json`**](../e-json#folders-and-files) parses bodies as JSON.
- [**`g-upload`**](../g-upload#folders-and-files) receives file upload forms.
- [**`i-graphql`**](../i-graphql#folders-and-files) receives GraphQL queries.
- [**`j-stream`**](../j-stream#folders-and-files) streams huge bodies.

We delay these examples a bit, so we can squeeze in a couple security topics
first. These examples do take client input, after all! So, it's better to
Expand All @@ -62,9 +62,9 @@ present them the right way.

**Next steps:**

- [**`7-template`**](../7-template#files) builds responses from templates and
- [**`7-template`**](../7-template#folders-and-files) builds responses from templates and
guards against injection attacks (XSS).
- [**`8-debug`**](../8-debug#files) renders error information in responses.
- [**`8-debug`**](../8-debug#folders-and-files) renders error information in responses.

<br>

Expand Down
18 changes: 9 additions & 9 deletions example/7-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,31 +125,31 @@ and not supported by Dream.

**Next steps:**

- [**`8-debug`**](../8-debug#files) shows how to turn on debug responses, and
- [**`8-debug`**](../8-debug#folders-and-files) shows how to turn on debug responses, and
get more info about errors.
- [**`9-error`**](../9-error#files) sets up a central error template for all
- [**`9-error`**](../9-error#folders-and-files) sets up a central error template for all
errors.
- [**`r-template`**](../r-template#files) is a Reason syntax version of this
- [**`r-template`**](../r-template#folders-and-files) is a Reason syntax version of this
example.

<br>

**See also:**

- [**`w-template-files`**](../w-template-files#files) moves the template into a
- [**`w-template-files`**](../w-template-files#folders-and-files) moves the template into a
separate `.eml.html` to avoid problems with editor support.
- [**`w-template-logic`**](../w-template-logic#files) shows how to put control
- [**`w-template-logic`**](../w-template-logic#folders-and-files) shows how to put control
flow into templates.
- [**`w-tyxml`**](../w-tyxml#files) shows how to use
- [**`w-tyxml`**](../w-tyxml#folders-and-files) shows how to use
[TyXML](https://github.com/ocsigen/tyxml), a different templater that uses
OCaml's type system to prevent emitting many kinds of invalid HTML.
- [**`r-tyxml`**](../r-tyxml#files) if you are using Reason. You can use TyXML
- [**`r-tyxml`**](../r-tyxml#folders-and-files) if you are using Reason. You can use TyXML
with JSX syntax server-side!
- [**`w-dream-html`**](../w-dream-html#files) shows how to use
- [**`w-dream-html`**](../w-dream-html#folders-and-files) shows how to use
[dream-html](https://github.com/yawaramin/dream-html), another alternative
library for generating HTML from OCaml, which is more closely integrated with
Dream.
- [**`w-template-stream`**](../w-template-stream#files) streams templates to
- [**`w-template-stream`**](../w-template-stream#folders-and-files) streams templates to
responses, instead of building up complete response strings.

<br>
Expand Down
6 changes: 3 additions & 3 deletions example/8-debug/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ work with in development.

You can have Dream show a custom error page with any information or graphics
that you like &mdash; we will do this in the [very next
example](../9-error#files)!
example](../9-error#folders-and-files)!

<!-- TODO Fix after stack trace is fixed. -->
<!-- TODO Show the log -->
Expand All @@ -104,9 +104,9 @@ example](../9-error#files)!

**Next steps:**

- [**`9-error`**](../9-error#files) handles all errors in one place, including
- [**`9-error`**](../9-error#folders-and-files) handles all errors in one place, including
displaying the debugger output.
- [**`a-log`**](../a-log#files) shows [log
- [**`a-log`**](../a-log#folders-and-files) shows [log
levels](https://aantron.github.io/dream/#type-log_level) and
[sub-logs](https://aantron.github.io/dream/#type-sub_log).

Expand Down
6 changes: 3 additions & 3 deletions example/9-error/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ including return a completely new response.
<br>

`debug_info` is a multiline string containing the same information as in the
previous example, [**`8-debug`**](../8-debug#files).
previous example, [**`8-debug`**](../8-debug#folders-and-files).

<!-- TODO Images of the generated pages. -->

Expand All @@ -80,9 +80,9 @@ Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet

**Next steps:**

- [**`a-log`**](../a-log#files) shows how to write messages to Dream's
- [**`a-log`**](../a-log#folders-and-files) shows how to write messages to Dream's
[log](https://aantron.github.io/dream/#logging).
- [**`b-session`**](../b-session#files) adds [session
- [**`b-session`**](../b-session#folders-and-files) adds [session
management](https://aantron.github.io/dream/#sessions) for associating state
with clients.

Expand Down
Loading
Loading