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
Using annotation
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
Examples
blank_shiny <- shiny::shinyApp(
ui = shiny::fluidPage(),
server = shiny::shinyServer(function(...) {})
)
api() |>
api_shiny("my_app/", blank_shiny)
#> ── A plumber server ────────────────────────────────────────────────────────────
#> Serving on http://127.0.0.1:8080
#> Currently not running