Skip to content

Instantly share code, notes, and snippets.

@gprasant
Created May 30, 2012 15:57
Show Gist options
  • Save gprasant/2837203 to your computer and use it in GitHub Desktop.
Save gprasant/2837203 to your computer and use it in GitHub Desktop.
library(Rook)
# to install Rook, which makes it possible to run R as a server,
# R -q -e "install.packages('Rook', repos='http://cran.r-project.org')"
app <- function(env){
req <- Rook::Request$new(env)
res <- Rook::Response$new()
res$write(42)
res$finish()
}
s = Rhttpd$new()
s$add(app = app, name = "helloworld")
s$start(port=8888)
while(T){
Sys.sleep(10000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment