Coder Social home page Coder Social logo

vikram-rawat / restrserve Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rexyai/restrserve

0.0 1.0 0.0 3.14 MB

R web API framework for building high-performance microservices and app backends

Home Page: http://restrserve.org/

R 78.61% Dockerfile 0.33% HTML 0.78% Shell 0.20% C++ 20.07%

restrserve's Introduction

RestRserve

Travis-CI Build Status Build status codecov License Lifecycle: maturing gitter tinyverse

RestRserve is an R web API framework for building high-performance AND robust microservices and app backends. With Rserve backend on UNIX-like systems it is parallel by design. It will handle incoming requests in parallel - each request in a separate fork (all the credits should go to Simon Urbanek).

Quick start

Creating application is as simple as:

library(RestRserve)
app = Application$new()
app$add_get(
  path = "/hello", 
  FUN = function(request, response) {
    response$set_body("Hello from RestRserve")
  })
backend = BackendRserve$new()
backend$start(app, http_port = 8080)

Now you can type http://localhost:8080/hello in your favorite browser and see (surprisingly!) Hello from RestRserve.

Learn RestRserve

Features

  • Easy to install, small number of dependencies
  • Fully featured http server with the support for URL encoded and multipart forms
  • Build safe and secure applications - RestRserve supports https, provides building blocks for basic/token authentication
  • Concise and intuitive syntax
  • Raise meaningful http errors and allows to interrupt request handling from any place of the user code
  • Comes with many examples - see inst/examples
  • Saves you from boilerplate code:
    • automatically decodes request body from the common formats
    • automatically encodes response body to the common formats
    • automatically parses URI templates (such as /get/{item_id})
    • helps to expose OpenAPI and Swagger/Redoc/Rapidoc UI
  • It is fast!

Installation

From source

remotes::install_github("rexyai/RestRserve")

Docker

Automated docker builds from docker-hub: https://hub.docker.com/r/rexyai/restrserve/

Contributing

Guidelines for filing issues / pull requests - CONTRIBUTING.md.

Acknowledgements

  • Simon Urbanek (@s-u) for awesome Rserve and all the work on R itself and on his other packages
  • Jeff Allen (@trestletech) for his work on Swagger UI in plumber (from where we took inspiration for our implementation)
  • Brodie Gaslam (@brodieG) for help with understanding on how to get traceback from try-catch function calls. Also thanks Hadley Wickham (@hadley) for evaluate::try_capture_stack function which we use for this purpose.

Known limitations

  • RestRserve is primarily tested on UNIX systems. While it works natively on Windows please don't expect it to be as performant as on UNIX-like systems. If you really want to use it on Windows - consider to use Windows Subsystem for Linux.
  • Keep in mind that every request is handled in a separate process (fork from a parent R session). While this feature allows to handle requests in parallel it also restricts reuse of certain objects which are not fork-safe (notably database connections, rJava objects, etc)

Related projects

restrserve's People

Contributors

artemklevtsov avatar dselivanov avatar jangorecki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.