servant/servant-client-ghcjs
2017-10-22 14:55:18 +02:00
..
src/Servant/Client servant-client-ghcjs: Fixed not throwing FailureResponse 2017-10-22 14:55:18 +02:00
CHANGELOG.md WIP! Untested! Initial servant-client-ghcjs package 2017-10-22 14:55:18 +02:00
LICENSE WIP! Untested! Initial servant-client-ghcjs package 2017-10-22 14:55:18 +02:00
README.md WIP! Untested! Initial servant-client-ghcjs package 2017-10-22 14:55:18 +02:00
servant-client-ghcjs.cabal servant-client-ghcjs: Fixed Accept and Content-Type headers not being set 2017-10-22 14:55:18 +02:00
Setup.hs WIP! Untested! Initial servant-client-ghcjs package 2017-10-22 14:55:18 +02:00
tinc.yaml WIP! Untested! Initial servant-client-ghcjs package 2017-10-22 14:55:18 +02:00

servant-client-ghcjs

servant

This library lets you automatically derive Haskell functions that let you query each endpoint of a servant webservice. This library is specifically for ghcjs, as opposed to servant-client.

Example

type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
        :<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books

myApi :: Proxy MyApi
myApi = Proxy

getAllBooks :: Manager -> BaseUrl -> ExceptT String IO [Book]
postNewBook :: Book -> Manager -> BaseUrl -> ExceptT String IO Book
-- 'client' allows you to produce operations to query an API from a client.
(getAllBooks :<|> postNewBook) = client myApi