Learn R Programming

xfun (version 0.60)

serve_dir: Serve a static directory

Description

Serve a directory of files via new_app(). If index.html exists under the directory, it is shown; otherwise a directory listing is shown. This is similar to servr::httd() and Python's http.server module.

Usage

serve_dir(dir = ".", name = "xfun-dir", ...)

Value

The app URL, returned invisibly.

Arguments

dir

The directory to serve.

name

The app name passed to new_app(). Use '' to serve the directory at the root URL via the proxy.

...

Other arguments passed to new_app().

Examples

Run this code
if (interactive()) {
xfun::serve_dir(tempdir())
}

Run the code above in your browser using DataLab