Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation about deploying programmatically built plumber api on RStudio Connect #868

Open
ColinFay opened this issue Jun 16, 2022 · 3 comments
Labels
docs Related to documentation only knowledge 🤯 Learn about common {plumber} problems

Comments

@ColinFay
Copy link
Contributor

Given the following plumber.R:

library(plumber)

#* @apiTitle Plumber Example API

pr() %>%
  pr_get("/", function(){
    "<html><h1>Programmatic Plumber!</h1></html>"
  }, serializer = plumber::serializer_html())

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 :)

@schloerke
Copy link
Collaborator

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())
}

@meztez
Copy link
Collaborator

meztez commented Nov 20, 2023

@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")

@meztez meztez added docs Related to documentation only answered? Waiting for confirmation that the issue is solved knowledge 🤯 Learn about common {plumber} problems labels Nov 24, 2023
@schloerke schloerke reopened this Jan 27, 2025
@schloerke
Copy link
Collaborator

@thomasp85 This still needs a doc update given #868 (comment) answer

@schloerke schloerke removed the answered? Waiting for confirmation that the issue is solved label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Related to documentation only knowledge 🤯 Learn about common {plumber} problems
Projects
None yet
Development

No branches or pull requests

4 participants