git.iko.soy/typeable/servant
on master help sign in
factor in @alp's feedbacks on PR #1455
8b93af3bChiquet
doc/tutorial/ApiType.lhs+7−7
@@ -390,10 +390,10 @@ with the rest of your API. But you can plug in everything that is an
390`Application`, e.g. a whole web application written in any of the web
390`Application`, e.g. a whole web application written in any of the web
391frameworks that support `wai`.
391frameworks that support `wai`.
392
392
393−Be mindful! This library works by pattern-matching the different routes that are
393+Be mindful! The `servant-server`'s router works by pattern-matching the
394−composed using `:<|>`. `Raw`, as an escape hatch, matches any route that hasn't
394+different routes that are composed using `:<|>`. `Raw`, as an escape hatch,
395+matches any route that hasn't been matched by previous patterns. Therefore,
395−been matched by previous patterns. Therefore, any subsequent route will be silently
396+any subsequent route will be silently ignored.
396−ignored.
397
397
398``` haskell
398``` haskell
399type UserAPI14 = Raw
399type UserAPI14 = Raw
@@ -403,12 +403,12 @@ type UserAPI14 = Raw
403 -- endpoint matches requests before
403 -- endpoint matches requests before
404```
404```
405A simple way to avoid this pitfall is to either use `Raw` as the last
405A simple way to avoid this pitfall is to either use `Raw` as the last
406−definition, or to always have it under a directory.
406+definition, or to always have it under a static path.
407
407
408``` haskell
408``` haskell
409type UserAPI15 = "files" :> Raw
409type UserAPI15 = "files" :> Raw
410− -- The raw endpoint is under a directory,
410+ -- The raw endpoint is under the /files
411− -- so it won't match /users.
411+ -- static path, so it won't match /users.
412 :<|> "users" :> Get '[JSON] [User]
412 :<|> "users" :> Get '[JSON] [User]
413
413
414type UserAPI16 = "users" :> Get '[JSON] [User]
414type UserAPI16 = "users" :> Get '[JSON] [User]