Learn R Programming

ambiorix (version 2.2.0)

pre_hook: Pre Hook Response

Description

Pre Hook Response

Usage

pre_hook(content, data)

Value

A response pre-hook.

Arguments

content

File content, a character vector.

data

A list of data passed to glue::glue_data.

Examples

Run this code
my_prh <- function(self, content, data, ext, ...) {
  data$title <- "Mansion"
  pre_hook(content, data)
}

#' Handler for GET at '/'
#' 
#' @details Renders the homepage
#' @export
home_get <- function(req, res) {
  res$pre_render_hook(my_prh)
  res$render(
    file = "page.html",
    data = list(
      title = "Home"
    )
  )
}

Run the code above in your browser using DataLab