devd_start: Start up a devd process

Description Usage Arguments Details Value Examples

Description

The creates a background devd process and returns a processx handle to it.

Usage

1
2
3
devd_start(routes = ".", log_headers = FALSE, live_reload = FALSE,
  live_watch = FALSE, basic_auth = NULL, open_browser = TRUE,
  tls = FALSE, crossdomain = TRUE)

Arguments

routes

a character vector of devd routes to setup

log_headers

Log HTTP headers for each rquest

live_reload

When live_reload is enabled, devd injects a small script into HTML pages, just before the closing head tag. The script listens for change notifications over a websocket connection, and reloads resources as needed. No browser addon is required, and live_reload works even for reverse proxied apps. If only changes to CSS files are seen, devd will only reload external CSS resources, otherwise a full page reload is done

live_watch

Enales live_reload and watch for static file changes

basic_auth

Supply a vector of c("username", "password") to enable basic auth for server (forces all requests to be authenticated)

open_browser

if TRUE then your default OS browser will be launched and pointed to the main route path

tls

Serve TLS with auto-generated self-signed certificate (in ~/.devd.cert)

crossdomain

if TRUE then we set the CORS header Access-Control-Allowed: *

Details

The default configuration (which should cover most use-cases) is to:

The returned processx::process() object lets you introspect the process, kill the process and return the last filled buffer from the error and "access" logs.

NOTE: IF you restart, terminate, close, etc the calling R process that started an underlying devd process you will need to start devd again (it's a child process of R). This is intentional as it should prevent you from leaving stale devd processes hanging around.

Value

processx process object

Examples

1
2
3
4
5
6
## Not run: 
dd <- devd_start()
devd_log(dd)
devd_stop(dd)

## End(Not run)

hrbrmstr/devd documentation built on May 5, 2019, 5:52 p.m.