opencpu (version 2.2.11)

ocpu-server: OpenCPU Single-User Server

Description

Starts the OpenCPU single-user server for developing and running apps locally. To deploy your apps on a cloud server or ocpu.io, simply push them to github and install the opencpu webhook. Some example apps are available from github::rwebapps/.

Usage

ocpu_start_server(
  port = 5656,
  root = "/ocpu",
  workers = 2,
  preload = NULL,
  on_startup = NULL,
  no_cache = FALSE
)

ocpu_start_app(app, update = TRUE, ...)

Arguments

port

port number

root

base of the URL where to host the OpenCPU API

workers

number of worker processes

preload

character vector of packages to preload in the workers. This speeds up requests to those packages.

on_startup

function to call once server has started (e.g. utils::browseURL)

no_cache

sets Cache-Control: no-cache for all responses to disable browser caching. Useful for development when files change frequently. You might still need to manually flush the browser cache for resources cached previously. Try pressing CTRL+R or go incognito if your browser is showing old content.

app

either the name of a locally installed package, or a github remote (see install_apps)

update

checks if the app is up-to-date (if possible) before running

...

extra parameters passed to ocpu_start_server

See Also

Other ocpu: apps

Examples

Run this code
if (FALSE) {
# List available demo apps
available_apps()

# Run application from: https://github.com/rwebapps/nabel
ocpu_start_app("rwebapps/nabel")

# Run application from: https://github.com/rwebapps/markdownapp
ocpu_start_app("rwebapps/markdownapp")

# Run application from: https://github.com/rwebapps/stockapp
ocpu_start_app("rwebapps/stockapp")

# Run application from: https://github.com/rwebapps/appdemo
ocpu_start_app("rwebapps/appdemo")

# Show currently installed apps
installed_apps()
}

Run the code above in your browser using DataCamp Workspace