IHP Api Reference
Safe HaskellNone

IHP.Controller.Render

Synopsis

Documentation

respondHtml :: (?context :: ControllerContext) => Html -> IO () Source #

respondSvg :: (?context :: ControllerContext) => Html -> IO () Source #

renderHtml :: (View view, ?context :: ControllerContext) => view -> IO Html Source #

renderFile :: (?context :: ControllerContext) => String -> ByteString -> IO () Source #

renderJson :: (?context :: ControllerContext, ToJSON json) => json -> IO () Source #

renderJsonWithStatusCode :: (?context :: ControllerContext, ToJSON json) => Status -> json -> IO () Source #

renderXml :: (?context :: ControllerContext) => LByteString -> IO () Source #

renderJson' :: (?context :: ControllerContext) => ResponseHeaders -> ToJSON json => json -> IO () Source #

Use setHeader intead

data PolymorphicRender Source #

Constructors

PolymorphicRender 

Fields

renderPolymorphic :: (?context :: ControllerContext) => PolymorphicRender -> IO () Source #

Can be used to render different responses for html, json, etc. requests based on Accept header Example:

show :: Action
show = do
    renderPolymorphic polymorphicRender {
        html = renderHtml [hsx|<div>Hello World</div>|]
        json = renderJson True
    }

This will render Hello World for normal browser requests and true when requested via an ajax request

render :: (View view, ?context :: ControllerContext) => view -> IO () Source #