Skip to content

Commit

Permalink
Create Plumber.R
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecilsingh authored Sep 17, 2024
1 parent 855a480 commit bfeaff6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions API/Plumber.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
library(plumber)

#* @apiTitle Plumber Example API

#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg=""){
list(msg = paste0("The message is: '", msg, "'"))
}

#* Plot a histogram
#* @serializer png
#* @get /plot
function(){
rand <- rnorm(100)
hist(rand)
}

#* Return the sum of two numbers
#* @param a The first number to add
#* @param b The second number to add
#* @post /sum
function(a, b){
as.numeric(a) + as.numeric(b)
}

0 comments on commit bfeaff6

Please sign in to comment.