new_app: Create a local web application

View source: R/app.R

new_appR Documentation

Create a local web application

Description

An experimental function to create a local web application based on R's internal httpd server (which is primarily for running R's dynamic help system).

Usage

new_app(name, handler, open = interactive(), ports = 4321 + 1:10)

Arguments

name

The app name (a character string, and each app should have a unique name).

handler

A function that takes the HTTP request information (the first argument is the requested path) and returns a response.

open

Whether to open the app, or a function to open the app URL.

ports

A vector of ports to try for starting the server.

Value

The app URL of the form ⁠http://127.0.0.1:port/custom/name/⁠.

Note

This function is not based on base R's public API, and is possible to break in the future, which is also why the documentation here is terse. Please avoid creating public-facing web apps with it. You may consider packages like httpuv and Rserve for production web apps.


xfun documentation built on Nov. 1, 2024, 1:06 a.m.