webAPI plumber

Published by onesixx on

http://blog.expresspixel.com/creating-a-web-api-for-r/

 

https://www.rplumber.io/
https://github.com/trestletech/plumber
https://www.rplumber.io/docs

There’s 3 options for you to use to build a web based API. 1. Shiny, 2. Deployrand 3. Plumber.

prediction.R

#* @get /prediction
function(){
	return("Hello World")
}

main.R

#!/usr/bin/env Rscript

library(plumber)
r <- plumb("prediction.R")
r$run(host="0.0.0.0", port=8000)

 

~/sixx/webAPI$ Rscript main.R
Starting server to listen on port 8000

 

 

Categories: R Basic

onesixx

Blog Owner

Leave a Reply

Your email address will not be published.