vignettes/files/apis/07-02-plot-safe.R

#* This is an example of an safe endpoint which
#* checks user input to avoid a DOS attack
#* @get /
#* @serializer png
function(pts=10) {
  if (pts > 1000 & pts > 0){
    stop("pts must be between 1 and 1,000")
  }

  plot(1:pts)
}
trestletech/plumber documentation built on May 6, 2024, 6:17 p.m.