Routes HTTP POST requests to the specified path with the specified callback functions or middleware.
httpPOST(beakr, path = NULL, FUN = NULL)
beakr |
|
---|---|
path | String representing a path for which the middleware function is invoked. |
FUN | Middleware function to be invoked. |
A Beakr
instance with added middleware.
if (FALSE) { library(beakr) # Create an new Beakr instance beakr <- newBeakr() # Create a simple beakr pipeline beakr %>% httpPOST("/", function(req, res, err) { return("Successful POST request!\n") }) %>% listen(host = '127.0.0.1', port = 25118, daemon = TRUE) # ------------------------------------------------------------ # IN A TERMINAL: # curl -X POST http://127.0.0.1:25118/ # > Successful POST request! # ------------------------------------------------------------ # Stop the beakr instance server stopServer(beakr) }