Learn R Programming

plumber (version 1.2.2)

pr_set_docs_callback: Set the callback to tell where the API visual documentation is located

Description

When set, it will be called with a character string corresponding to the API visual documentation url. This allows RStudio to locate visual documentation.

Usage

pr_set_docs_callback(
  pr,
  callback = get_option_or_env("plumber.docs.callback", NULL)
)

Value

The Plumber router with the new docs callback setting.

Arguments

pr

A Plumber API. Note: The supplied Plumber API object will also be updated in place as well as returned by the function.

callback

a callback function for taking action on the docs url.

Details

If using options_plumber(), the value must be set before initializing your Plumber router.

Examples

Run this code
if (FALSE) {
pr() %>%
  pr_set_docs_callback(function(url) { message("API location: ", url) }) %>%
  pr_get("/plus//", function(a, b) { a + b }) %>%
  pr_run()
}

Run the code above in your browser using DataLab