Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data ReqBody contentTypes a
Documentation
data ReqBody contentTypes a Source
Extract the request body as a value of type a
.
Example:
>>>
-- POST /books
>>>
type MyApi = "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book
>>>
import Servant.API
>>>
import Servant.Common.Text
>>>
import Data.Aeson
>>>
import Data.Text
>>>
data Book
>>>
instance ToJSON Book where { toJSON = undefined }