| api_shiny | R Documentation |
You can serve one or more shiny apps as part of a plumber2 api. The shiny app
launches in a background process and the api will work as a reverse proxy to
forward requests to path to the process and relay the response to the
client. The shiny app is started along with the api and shut down once the
api is stopped. This functionality requires the shiny and callr packages to
be installed. Be aware that all requests to subpaths of path will be
forwarded to the shiny process, and thus not end up in your normal route
api_shiny(api, path, app, except = NULL, auth_flow = NULL, auth_scope = NULL)
api |
A plumber2 api to add the shiny app to |
path |
The path to serve the shiny app from |
app |
A shiny app object |
except |
Subpaths to |
auth_flow |
A logical expression giving the authentication flow the client must pass to get access to the resource. |
auth_scope |
The scope requirements of the resource |
This functions return the api object allowing for easy chaining
with the pipe
A shiny app can be served using an annotated route file by using the @shiny
tag and proceeding the annotation block with the shiny app object
#* @shiny /my_app/
shiny::shinyAppDir("./shiny")
blank_shiny <- shiny::shinyApp(
ui = shiny::fluidPage(),
server = shiny::shinyServer(function(...) {})
)
api() |>
api_shiny("my_app/", blank_shiny)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.