Per the documentation for plumber::plumb():
if an entrypoint.R file is found, it will take precedence and be responsible for returning a runnable Plumber router
This means that entrypoint.R should be a file that returns a runnable Plumber router. See the following example files:
# plumber.R
library(plumber)
#* @apiTitle Entrypoint example
#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg = "") {
list(msg = paste0("The message is: '", msg, "'"))
}
# entrypoint.R
pr <- plumb("plumber.R")
# Register an exit handler
pr$registerHook("exit", function(){
print("See ya later")
})
pr
To run this API with the hook that is registered in entrypoint.R, you would run plumber::plumb(dir = "path/to/api/directory")$run() and Plumber would then recognize the entrypoint.R file. Alternatively, recent versions of RStudio provide an option to "Run API" when editing a plumber file, and this will automatically invoke the command referenced earlier.
When it comes to publishing to RStudio Connect, you should be able to click on the publish button while editing plumber.R. This will bring up the following options:
If you include an entrypoint.R file in your deployment (like what is shown), RStudio Connect will honor that file and use it to run the API, which will register any hooks that you've defined in entrypoint.R.
Hopefully this helps! If you have other questions or if I missed the mark here, let me know.