Launches one of the example apps shipped in the package's examples
folder. Each is an app directory with an app.R that calls spigot_app();
read them with system.file("examples", package = "spigot").
Arguments
- name
Name of the example:
"minimal","live"or"site".- ...
Passed to
shiny::runApp(), for exampleportorlaunch.browser.
Value
The value of shiny::runApp(), once the app is stopped.
Details
"minimal": one hand-written HTML page that calls a plumber API mounted in the same Shiny app: a GET with a query parameter, a JSON POST, an endpoint that returns a data frame and validates its input, and a slow async endpoint that does not block other requests."live": a count shared by every open tab. Each click is an HTTP call; R pushes the new count to every tab withspigot_broadcast(), and sets an input of the calling tab withspigot_trigger()so its server function updates a Shiny output on the page."site": three pages built from whisker templates that share partials, one rendered from data in R, and an endpoint that does its work in afutureworker. Needs the future package.
Examples
if (interactive()) {
run_example("live")
}
# The bundled examples:
list.files(system.file("examples", package = "spigot"))
#> [1] "live" "minimal" "site"