plumber_docs | R Documentation |
Normally documentation is registered in the '.onLoad()' method of the package. To avoid a circular dependency with 'swagger' when 'plumber' are starting up, ‘plumber' must retrieve this information manually on it’s startup.
plumber_docs()
See the examples for how documentation should regularly be registered.
## Not run:
## Suggested setup for other packages trying to register visual docs for plumber
.onLoad <- function(...) {
plumber_register_ui <- function() {
tryCatch({
do.call(plumber::register_ui, plumber_docs())
}, error = function(e) {
message("Error registering swagger docs. Error: ", e)
})
}
setHook(packageEvent("plumber", "onLoad"), function(...) {
plumber_register_ui()
})
if ("plumber" %in% loadedNamespaces()) {
plumber_register_ui()
}
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.