Prettynice.Response
HTTP Responses
An HTTP response value.
Setting the Response Body
Update a response to send HTML.
title
will go into the <title>
tag,
head
will be added to the <head>
tag,
and body
will go into the <body>
tag.
Note that Prettynice uses and expects Html from icidasset/html-gren, not from gren-lang/browser. The API is the same, but html-gren is needed because it supports server-side rendering.
See the html example for a working usage example.
Update a response to send json.
See the json example for a working usage example.
Update a response to send plain text.
See the hello world example for a working usage example.
Update a response to send raw bytes.
Use this to send binary data like files, images, etc. See the bytes example for a working usage example.
Setting the Response headers and status
Add a header to the response.
Set the status of the response.
Event Messages
Send a message to your update
function when a response is sent.
See the websocket example for a working usage example.
Raw HTTP Responses
Use these functions to work with a raw Http.Response directly. You shouldn't need them in a typical Prettynice application but if you want to do something weird and cool I'm not going to stop you.
Turn a Node HttpServer Response into a Prettynice Response.
You shouldn't need this in your normal application code. The response you get in a Prettynice request message is already a Prettynice Response.
Turn a Prettynice Response back into a normal Node HttpServer Response
You shouldn't need this in a typical Prettynice program. But it's here if you want to do anything weird and cool.