build {microCRAN}R Documentation

Build and start the microCRAN site

Description

build creates the Plumber-router and run starts the service.

Usage

build(
  repo_dir,
  url_path,
  redirect_url,
  title,
  description,
  contact,
  license,
  tos
)

run(pr, host = "127.0.0.1", port = 1881, url_path, ...)

Arguments

repo_dir

Path to local directory, where the root of the repository is. The (source) packages will be stored locally at ⁠{repo_dir}/src/contrib/⁠.

url_path

Optional prefix to endpoint. The CRAN repository will be available at e.g. ⁠http://127.0.0.1:port/path_prefix/⁠ with the "contrib.url" as ⁠http://127.0.0.1:port/path_prefix/src/contrib/⁠.

redirect_url

Url, if supplied, requests to static assets (package files, etc.) are redirected to another service instead of being handled by cran_static_path_handler. It can be beneficial to let e.g. an Apache httpd service handle those.

title, description, contact, license, tos

Descriptions of the API. Some defaults are used, see section below or https://www.rplumber.io/articles/annotations.html.

pr

A Plumber-router, e.g. as returned from build.

host

A string that is a valid IPv4 or IPv6 address that is owned by this server, which the application will listen on. "0.0.0.0" represents all IPv4 addresses and "::/0" represents all IPv6 addresses.

port

A number or integer that indicates the server port that should be listened on. Note that on most Unix-like systems including Linux and Mac OS X, port numbers smaller than 1025 require root privileges.

...

Additional arguments passed on to plumber::pr_run().

run

Logical, should the method run the site immediately?

Details

Point repo_dir to you local filesystem. If the (sub-)directory does not exist, it will be created when an R-package is added through the corresponding endpoint.

Value

A new Plumber-router object.

API Descriptions

The fields title, description, contact, license, and tos are used for describing the API in the resulting Swagger-documents. These follow the OpenAPI type descriptions, see https://spec.openapis.org/oas/v3.0.3#info-object.

Field name Type Description
title string The title of the API.
description string A short description of the API.
tos string A URL to the Terms of Service for the API.
contact list A "Contact Object", i.e., list-object with fields "name", "url" and "email".
license list A "License Object", i.e., list-object with fields "name" and "url".
version string The version of the API.

[Package microCRAN version 0.9.0-1 Index]