
RestRserve is an R web API framework for building high-performance AND robust microservices and app backends. On UNIX-like systems and Rserve backend RestRserve handles requests in parallel: each request in a separate fork - credits go to Simon Urbanek.
Creating application is as simple as:
library(RestRserve)
app = Application$new()
app$add_get(
path = "/health",
FUN = function(.req, .res) {
.res$set_body("OK")
})
app$add_post(
path = "/addone",
FUN = function(.req, .res) {
result = list(x = .req$body$x + 1L)
.res$set_content_type("application/json")
.res$set_body(result)
})
backend = BackendRserve$new()
backend$start(app, http_port = 8080)Test it with curl:
curl localhost:8080/health
# OK
curl -H "Content-Type: application/json" -d '{"x":10}' localhost:8080/addone
# {"x":11}Using convenient .req, .res names for
handler arguments allows to leverage autocomplete.

/get/{item_id})
install.packages("RestRserve", repos = "https://cloud.r-project.org")Debian and Alpine based images are available on docker-hub -https://hub.docker.com/r/rexyai/restrserve/
docker pull rexyai/restrserveYou can also install specific version (and we encourage to do so):
docker pull rexyai/restrserve:1.2.0-alpineGuidelines for filing issues / pull requests - CONTRIBUTING.md.
evaluate::try_capture_stack function which we use for this
purpose.
Need a high-speed mirror for your open-source project?
Contact our mirror admin team at info@clientvps.com.
This archive is provided as a free public service to the community.
Proudly supported by infrastructure from VPSPulse , RxServers , BuyNumber , UnitVPS , OffshoreName and secure payment technology by ArionPay.