app | R Documentation |
The entrypoint for a Rhino application.
Your app.R
should contain nothing but a call to rhino::app()
.
app()
This function is a wrapper around shiny::shinyApp()
.
It reads rhino.yml
and performs some configuration steps (logger, static files, box modules).
You can run a Rhino application in typical fashion using shiny::runApp()
.
Rhino will load the app/main.R
file as a box module (box::use(app/main)
).
It should export two functions which take a single id
argument -
the ui
and server
of your top-level Shiny module.
An object representing the app (can be passed to shiny::runApp()
).
It is possible to specify a different way to load your application
using the legacy_entrypoint
option in rhino.yml
:
app_dir
: Rhino will run the app using shiny::shinyAppDir("app")
.
source
: Rhino will source("app/main.R")
.
This file should define the top-level ui
and server
objects to be passed to shinyApp()
.
box_top_level
: Rhino will load app/main.R
as a box module (as it does by default),
but the exported ui
and server
objects will be considered as top-level.
The legacy_entrypoint
setting is useful when migrating an existing Shiny application to Rhino.
It is recommended to transform your application step by step:
With app_dir
you should be able to run your application right away
(just put the files in the app
directory).
With source
setting your application structure must be brought closer to Rhino,
but you can still use library()
and source()
functions.
With box_top_level
you can be confident that the whole app is properly modularized,
as box modules can only load other box modules (library()
and source()
won't work).
The last step is to remove the legacy_entrypoint
setting completely.
Compared to box_top_level
you'll need to make your top-level ui
and server
into a Shiny module
(functions taking a single id
argument).
## Not run:
# Your `app.R` should contain nothing but this single call:
rhino::app()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.