R/create_api.R

Defines functions create_api

Documented in create_api

#' create_api
#'
#' create the dirctory containing the plumber API and Dockerfile necessary to create
#' a Docker image for the polished API.
#'
#' @param dir_path the path to the directory that will contain the newly created
#' plumber API and Dockerfile.
#'
#' @return nothing
#'
#' @export
#'
#' @examples
#'
#' \dontrun{
#'   create_api()
#' }
#'
#'
create_api <- function(dir_path = "./polished_api") {

  api_dir <- system.file("plumber", package = "polishedapi")

  files <- c(
    file.path(api_dir, "api"),
    file.path(api_dir, "Dockerfile")
  )

  dir.create("polished_api")
  file.copy(
    from = files,
    to = dir_path,
    overwrite = TRUE,
    recursive = TRUE,
    copy.mode = TRUE
  )
}
Tychobra/polishedapi documentation built on July 19, 2020, 11:41 p.m.