#
# This application runs any file found in tempdir() through brew.
#
s <- Rhttpd$new()
if (FALSE) {
s$start(quiet=TRUE)
}
cat("Random Number: <%=rnorm(1)%>",
file=file.path(tempdir(),"index.html"))
s$add(name="random",
app=Builder$new(
Brewery$new(url="/",root=tempdir()),
Redirect$new("/index.html")
)
)
if (FALSE) {
s$browse('random') # Opens a browser window to the app.
}
file.remove(file.path(tempdir(),"index.html"))
s$remove(all=TRUE)
rm(s)
Run the code above in your browser using DataLab