# NOT RUN {
## View API using Swagger UI
# Official Website: https://swagger.io/tools/swagger-ui/
# install.packages("swagger")
if (require(swagger)) {
pr() %>%
pr_set_docs("swagger") %>%
pr_get("/plus/<a:int>/<b:int>", function(a, b) { a + b }) %>%
pr_run()
}
## View API using Redoc
# Official Website: https://github.com/Redocly/redoc
# remotes::install_github("https://github.com/meztez/redoc/")
if (require(redoc)) {
pr() %>%
pr_set_docs("redoc") %>%
pr_get("/plus/<a:int>/<b:int>", function(a, b) { a + b }) %>%
pr_run()
}
## View API using RapiDoc
# Official Website: https://github.com/mrin9/RapiDoc
# remotes::install_github("https://github.com/meztez/rapidoc/")
if (require(rapidoc)) {
pr() %>%
pr_set_docs("rapidoc") %>%
pr_get("/plus/<a:int>/<b:int>", function(a, b) { a + b }) %>%
pr_run()
}
## Disable the OpenAPI Spec UI
pr() %>%
pr_set_docs(FALSE) %>%
pr_get("/plus/<a:int>/<b:int>", function(a, b) { a + b }) %>%
pr_run()
# }
Run the code above in your browser using DataLab