This library lets you implement an HTTP server with handlers for each endpoint of a servant API, handling most of the boilerplate for you.
We've written a tutorial guide that introduces the core types and features of servant. After this article, you should be able to write your first servant webservices, learning the rest from the haddocks' examples.
hoistServermember to the
HasServerclass, which is
Headerto throw 400 when parsing fails (#724)
err422error codes (#739)
Handleris now an abstract datatype. Migration hint: change
QueryParamto throw 400 when parsing fails (#649)
err422Unprocessable Entity (#646)
serveDirectoryWithwhich offer 4 default options and a more flexible one for serving static files. (#658)
- Remove module
- Support GHC 8.0
Routertype has been changed. Static router tables should now be properly shared between requests, drastically increasing the number of situations where servers will be able to route requests efficiently. Functions
layoutWithContexthave been added to visualize the router layout for debugging purposes. Test cases for expected router layouts have been added.
- If an endpoint is discovered to have a non-matching "accept header", this is now a recoverable rather than a fatal failure, allowing different endpoints for the same route, but with different content types to be specified modularly.
If servers use the
BasicAuthcombinator and receive requests with missing or invalid credentials, the resulting error responses (401 and 403) could be overwritten by subsequent alternative routes. Now
FailFataland the error responses can't be overwritten anymore.
Query parameters that can't be parsed result in a
Configmachinery (https://github.com/haskell-servant/servant/pull/327). This is a breaking change, as the signatures of both
serveand the typeclass
HasServernow take an additional parameter.
- Support for the
EitherTin favor of
- Remove matrix params.
- Redefined constructors of
Delayedand related functions (
- Added support for Basic Authentication
- Add generalized authentication support via the
AuthServerDatatype family and
- Bump attoparsec upper bound to < 0.14
- Bump wai-app-static upper bound to < 3.2
- Bump either upper bound to < 4.5
Deletenow is like
Patchand returns a response body
- Add a
RouteMismatchconstructor for arbitrary HTTP response codes (https://github.com/haskell-servant/servant-server/pull/22)
- Add support for the
- Support for
Content-typeheaders and for the content-type aware combinators in servant-0.4
- Support other Monads than just
EitherT (Int, String) IO(https://github.com/haskell-servant/servant-server/pull/21)
- Make methods return status code 204 if they return () (https://github.com/haskell-servant/servant-server/issues/28)
- Add server support for response headers
errXXXfunctions for HTTP errors with sensible default reason strings
enterfunction for applying natural transformations to handlers
- Added support for matrix parameters, see e.g. http://www.w3.org/DesignIssues/MatrixURIs.html
- Add support for serializing based on Accept header (https://github.com/haskell-servant/servant-server/issues/9)
- Ignore trailing slashes (https://github.com/haskell-servant/servant-server/issues/5)
- Fix consuming request body issue (https://github.com/haskell-servant/servant/issues/3)
- Make code sample in Servant.Server complete