File: deployAPI.R

package info (click to toggle)
r-cran-rsconnect 1.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,044 kB
  • sloc: python: 185; sh: 13; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 926 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#' Deploy a Plumber API
#'
#' Deploys an application consisting of plumber API routes. The given directory
#' must contain a script returning a `plumb` object or a plumber API definition.
#'
#' @param api Path to the API project directory. Must contain either
#'   `entrypoint.R` or `plumber.R`
#' @param ... Additional arguments to [deployApp()].
#'
#' @details Deploy a plumber API definition by either supplying a directory
#'   containing `plumber.R` (an API definition) or `entrypoint.R` that returns a
#'   `plumb` object created by `plumber::plumb()`. See the plumber documentation
#'   for more information.
#'
#' @family Deployment functions
#' @export
deployAPI <- function(api, ...) {
  check_installed(
    "plumber",
    version = "0.3.2",
    reason = "to deploy plumber APIs"
  )

  check_directory(api)

  # Checking for entrypoint.R or plumber.R is done in `lint-framework.R`
  deployApp(appDir = api, ...)
}