
Create a route that renders and serves an Rmarkdown or Quarto report
Source:R/report_route.R
report_route.Rd
This route allows you to serve a report written as a Quarto/Rmarkdown
document. The report will be rendered on demand using the query params as
parameters for the report if they match. Depending on the value of the value
of max_age
the rendered report is kept and served without a re-render on
subsequent requests. The rendering can happen asynchronously in which case
a promise is returned.
Usage
report_route(
path,
file,
...,
max_age = Inf,
async = TRUE,
finalize = NULL,
continue = FALSE,
ignore_trailing_slash = FALSE
)
Arguments
- path
The url path to serve the report from
- file
The quarto or rmarkdown file to use for rendering of the report
- ...
Further arguments to
quarto::quarto_render()
orrmarkdown::render()
- max_age
The maximum age in seconds to keep a rendered report before initiating a re-render
- async
Should rendering happen asynchronously (using mirai)
- finalize
An optional function to run before sending the response back. The function will receive the request as the first argument, the response as the second, and anything passed on through
...
in thedispatch
method. Any return value from the function is discarded. The function must accept...
- continue
A logical that defines whether the response is returned directly after rendering or should be made available to subsequent routes
- ignore_trailing_slash
Should
path
be taken exactly or should both a version with and without a terminating slash be accepted
Value
A route object
Details
Only the formats explicitely stated in the header of the report are allowed and the will be selected through content negotiation. That means that if multiple formats produces the same file type, only the first will be available. If no format is specified the default for both Quarto and Rmarkdown documents is HTML