responses {ambiorix} | R Documentation |
Plain Responses
Description
Plain HTTP Responses.
Usage
response(body, headers = list(), status = 200L)
response_404(
body = "404: Not found",
headers = list(`Content-Type` = content_html()),
status = 404L
)
response_500(
body = "500: Server Error",
headers = list(`Content-Type` = content_html()),
status = 500L
)
Arguments
body |
Body of response. |
headers |
HTTP headers. |
status |
Response status |
Value
An Ambiorix response.
Examples
app <- Ambiorix$new()
# html
app$get("/", function(req, res){
res$send("hello!")
})
# text
app$get("/text", function(req, res){
res$text("hello!")
})
if(interactive())
app$start()
[Package ambiorix version 2.2.0 Index]