@@ -23,9 +23,11 @@ newtype Greet = Greet Text
2323instance FromJSON Greet
2424instance ToJSON Greet
2525
26+-- | A 'Greet' value can be rendered to 'JSON'.
2627instance MimeRender JSON Greet where
2728 toByteString Proxy = encodePretty
2829
30+-- | A 'Greet' value can be rendered to 'HTML'.
2931instance MimeRender HTML Greet where
3032 toByteString Proxy (Greet s) = "<h1>" <> cs s <> "</h1>"
3133
@@ -74,12 +76,12 @@ intro2 = DocIntro "This title is below the last"
7476
7577-- API specification
7678type TestApi =
77− -- GET /hello/:name?capital={true, false} returns a Greet as JSON
79+ -- GET /hello/:name?capital={true, false} returns a Greet as JSON or HTML
7880 "hello" :> MatrixParam "lang" String :> Capture "name" Text :> QueryParam "capital" Bool :> Get '[JSON, HTML] Greet
7981
8082 -- POST /greet with a Greet as JSON in the request body,
8183 -- returns a Greet as JSON
82− :<|> "greet" :> ReqBody '[JSON,HTML] Greet :> Post '[JSON] Greet
84+ :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet
8385
8486 -- DELETE /greet/:greetid
8587 :<|> "greet" :> Capture "greetid" Text :> Delete