Giter VIP home page Giter VIP logo

plumber_demo's Introduction

Brief Plumber Demo

So you are interested in web API's but don't know where to start as an R user. One launchpad is the plumber library, which advertises itself as the tool that "gives you the ability to automatically generate and serve an HTTP API from R functions using the annotations in the R documenation around your functions.".

In this brief document, my goals are threefold. First, I will walk you through a boilerplate example expertly lifted from the plumber documentation. Next, I will lift an example from a demonstrate I did years ago for the CSG Justice Center. Finally, I will set up some resources for those interested in diving deeper into the subject of building web API's with plumber.

Before you get started, install and launch the tool:

install.packages("plumber")

Assuming you did not get any catastrophic error messages when running the command above, your are now ready to move forward with this walkthrough ๐Ÿš€.

An Abridged Introduction

If your curiosity has been piqued, you've probably already googled the term "R plumber" and probably found the documentation expertly put together by the package authors.

I have created a small example on this repo largely to highlight a couple of ideas. You will find those under the plumber.R file.

To run it, clone it. Then use the following commands:

library(plumber)
root <- pr('plumber.R')
pr_run(root, port = 8000)

Check it out with CURL:

curl http://127.0.0.1:8000/echo

With Swagger:

http://127.0.0.1:8000/__docs__/

Or your browser!

On the Web

This section is under construction ๐Ÿšง... I mostly copied what was done here (plus or minus some Git)

Other examples?

Funny enough I had put something together for my first call with CSG Justice Center. You can find that here.

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.