git.iko.soy/typeable/servant
on cdbe95b help sign in
typeable/servant/README.md
22 lines 775 B history raw
1# servant-client
3[![Build Status](https://secure.travis-ci.org/haskell-servant/servant-client.svg)](http://travis-ci.org/haskell-servant/servant-client)
5![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)
7This library lets you derive automatically Haskell functions that let you query each endpoint of a *servant* webservice.
9## Example
11``` haskell
12type MyApi = "books" :> Get [Book] -- GET /books
13 :<|> "books" :> ReqBody Book :> Post Book -- POST /books
15myApi :: Proxy MyApi
16myApi = Proxy
18getAllBooks :: BaseUrl -> EitherT String IO [Book]
19postNewBook :: Book -> BaseUrl -> EitherT String IO Book
20-- 'client' allows you to produce operations to query an API from a client.
21(getAllBooks :<|> postNewBook) = client myApi
22```