doc: add a tip about how to serve on /

This commit is contained in:
Sönke Hahn 2016-07-15 19:31:16 +02:00
parent a844b7c297
commit ecfa78d222

View file

@ -58,6 +58,14 @@ Let's break that down:
is equivalent to `/list-all/users`. This means that sometimes `:>` is somehow is equivalent to `/list-all/users`. This means that sometimes `:>` is somehow
equivalent to `/`, but sometimes it just lets you chain another combinator. equivalent to `/`, but sometimes it just lets you chain another combinator.
Tip: If your endpoint responds to `/` (the root path), just omit any combinators
that introduce path segments. E.g. the following api has only one endpoint on `/`:
``` haskell
type RootEndpoint =
Get '[JSON] User
```
We can also describe APIs with multiple endpoints by using the `:<|>` We can also describe APIs with multiple endpoints by using the `:<|>`
combinators. Here's an example: combinators. Here's an example: