Create a local web application based on R's internal httpd.
new_app(name, handler, open = interactive(), host = "127.0.0.1", port = NULL)stop_app(name = names(.proxy$apps))
new_app() returns the app URL invisibly. stop_app() returns
nothing.
App name (a character string). Use name = '' to serve the app
at the root URL http://host:PORT/ via the proxy. If name is non-empty,
the app is served directly by R's internal httpd at /custom/name/. Each
name must be unique; calling new_app() with an existing name replaces
that app. For stop_app(), a character vector of app names to stop;
defaults to all running apps.
A function with signature function(path, query, post, headers) that handles HTTP requests and returns a response list.
Whether to open the app URL in a browser, or a function to open
it. In non-interactive sessions this also controls whether the call
blocks: passing open = FALSE explicitly suppresses both browser-opening
and blocking.
Bind address for the proxy ("127.0.0.1" or "0.0.0.0"). Only
used when name = ''.
Candidate proxy ports when name = ''. The first available port
is selected (falling back to random_port() if needed). Ignored when
name != ''.
new_app() has two modes:
name = '': start an app behind a lightweight proxy at
http://host:PORT/, forwarding to R's internal httpd path
/custom/xfun:PORT/.
name != '': register a legacy app directly on R's internal httpd at
http://127.0.0.1:BACKEND/custom/name/ (compatible with older versions).
stop_app() deregisters one or more running apps.