httpd: Worker server

Description Usage Arguments Examples

Description

Example which handles POST / PUT requests in worker procs.

Usage

1
httpd(app, port = 9999, size = 4, preload = NULL)

Arguments

app

callback function

port

which port to run the httpd

size

number of worker processes

preload

character vector of packages to preload in the workers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
httpd(function(env){
library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
str <- paste(capture.output(print(fm1)), collapse = "\n")
list(
  status = 200,
  body = paste("pid:", Sys.getpid(), "\n\n", str),
  headers = c("Content-Type" = "text/plain")
)
}, preload = "lme4")

## End(Not run)

jeroen/httpd documentation built on May 19, 2019, 5:09 a.m.