gp_plumb | R Documentation |
Launch a webserver via plumber to serve data
gp_plumb(
run = TRUE,
port = 8000,
file = "R/plumber.R",
front = FALSE,
host = "127.0.0.1",
background = TRUE
)
run |
should plumber run the server or return it as an object |
port |
to serve from |
file |
location of plumber.R file used by plumber |
front |
should geoplumber start the front dev server? Defaults |
host |
host to pass to plumber default |
background |
run the R process in the background using callr,
defaults to |
an instance of plumber::plumb if run
is set to FALSE
,
a process id from callr::r_bg
to easily destroy if parameter
background
is default TRUE
.
gp_plumb_front()
{
d <- file.path(tempdir(), "gp")
gp_create(d)
old <- setwd(d)
ps <- gp_plumb()
ps
Sys.sleep(1) # just in case
ps
require(RCurl)
webpage <- getURL("http://localhost:8000")
webpage <- readLines(tc <- textConnection(webpage)); close(tc)
tail(webpage)
ps$kill()
setwd(old)
unlink(d, recursive = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.