Open ColinFay opened 2 years ago
The plumber.R
file needs to be plumbI()
-able. So it must use annotations vs returning a working pr
object.
Untested plumber.R
code which uses a @plumber
decorator to update the "currently being plumb()
ed" router:
library(plumber)
#* @apiTitle Plumber Example API
#* @plumber
function(pr) {
pr %>%
pr_get("/", function(){
"<html><h1>Programmatic Plumber!</h1></html>"
}, serializer = plumber::serializer_html())
}
@ColinFay You can also name your file entrypoint.R
entrypoint.R
library(plumber)
pr() |>
pr_get("/", function(){
"<html><h1>Programmatic Plumber!</h1></html>"
}, serializer = plumber::serializer_html()) |>
pr_set_docs("swagger")
Then deploy to connect
rsconnect::deployApp(appFiles = "entrypoint.R", appMode = "api")
Given the following plumber.R:
If I publish to RStudio Connect the file as is, the API is empty. I wasn't able to find documentation about deploying this structure on Connect.
Any chance this could be added to the pkgdown website?
Thanks :)