inst/examples/static/app.R

#!/usr/bin/env Rscript

## ---- load packages ----

library(RestRserve)


## ---- create application -----

app = Application$new(
  content_type = "text/plain"
)


## ---- register endpoints and corresponding R handlers ----

app$add_static(
  path = "/hello",
  file_path = "public/hello.txt"
)

app$add_static(
  path = "/dir",
  file_path = "public/dir"
)

app$add_static(
  path = "/",
  file_path = "public/dir"
)


## ---- start application ----
backend = BackendRserve$new()
# backend$start(app, http_port = 8080)

Try the RestRserve package in your browser

Any scripts or data that you put into this service are public.

RestRserve documentation built on Sept. 12, 2022, 9:06 a.m.