cran_static_path_handler {microCRAN} | R Documentation |
Handler for package repository files
Description
Creates handler for handling access to static files in the repository,
i.e., the src/contrib
, bin/windows/contrib
, and bin/macosx/contrib
subdirectories.
Use cran_static_redirect_handler to let another process (e.g. an Apache httpd or nginx server) handle the request, by redirecting it.
Usage
cran_static_path_handler(repo_dir, path_prefix = NULL)
cran_static_redirect_handler(dest_url)
Arguments
repo_dir |
Path to local directory, where the root of the repository is.
The (source) packages will be stored locally at
|
path_prefix |
Optional URL-component, if the repository exists at a
subdirectory of the host (see run's |
dest_url |
The url requests are forwarded to, after being appened with the request; it should contain all path-components up to the '/src' or '/bin' parts. |
Value
A handler (function) for use in a Plumber router "filter" .
Examples
require(plumber)
pr() |>
pr_filter('static',
cran_static_path_handler(repo_dir, path_prefix = 'cran'))
pr() |>
pr_filter('redirect',
cran_static_redirect_handler("http://my.local.cran:80/cran"))