Closed psolymos closed 3 years ago
Should modify plumber based template.
# index.R #!/usr/bin/env Rscript suppressMessages(library(httpuv)) source("function/handler.R") # curl http://localhost:5000 -H "Content-Type: application/json" -d '["Friend"]' httpuv::runServer( host = "0.0.0.0", port = 5000, app = list( call = function(req) { list( status = 200L, headers = list( 'Content-Type' = 'application/json' ), body = handle(req) ) } ) )
# handler.R handle <- function(req) { input <- req[["rook.input"]] postdata <- input$read_lines() jsonlite::toJSON( paste0("Hello ", jsonlite::fromJSON( paste(postdata)), "!")) }
DESCRIPTION to list jsonlite (not a dependency for httpuv)
PR #27 closed this
Should modify plumber based template.
DESCRIPTION to list jsonlite (not a dependency for httpuv)