Learn R Programming

plumber (version 0.3.1)

include_file: Send File Contents as Response

Description

Returns the file at the given path as the response.

Usage

include_file(file, res, content_type)

include_html(file, res)

include_md(file, res, format = NULL)

include_rmd(file, res, format = NULL)

Arguments

file
The path to the file to return
res
The response object into which we'll write
content_type
If provided, the given value will be sent as the Content-type header in the response.
format
Passed as the output_format to rmarkdown::render

Details

include_html will merely return the file with the proper content_type for HTML. include_md and include_rmd will process the given markdown file through rmarkdown::render and return the resultant HTML as a response.