git.iko.soy/typeable/servant
on master help sign in
doc: add a tip about how to serve on `/`
ecfa78dSönke Hahn
doc/tutorial/ApiType.lhs+8
@@ -58,6 +58,14 @@ Let's break that down:
58 is equivalent to `/list-all/users`. This means that sometimes `:>` is somehow
58 is equivalent to `/list-all/users`. This means that sometimes `:>` is somehow
59 equivalent to `/`, but sometimes it just lets you chain another combinator.
59 equivalent to `/`, but sometimes it just lets you chain another combinator.
60
60
61+Tip: If your endpoint responds to `/` (the root path), just omit any combinators
62+that introduce path segments. E.g. the following api has only one endpoint on `/`:
63+
64+``` haskell
65+type RootEndpoint =
66+ Get '[JSON] User
67+```
68+
61We can also describe APIs with multiple endpoints by using the `:<|>`
69We can also describe APIs with multiple endpoints by using the `:<|>`
62combinators. Here's an example:
70combinators. Here's an example:
63
71