Description Usage Arguments Value Examples
View source: R/utils-httpRouters.R
Routes HTTP GET requests to the specified path with the specified callback functions or middleware.
1 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
library(beakr)
# Create an new Beakr instance
beakr <- newBeakr()
# Create a simple beakr pipeline
beakr %>%
httpGET("/", function(req, res, err) {
return("Successful GET request!\n")
}) %>%
listen(host = '127.0.0.1', port = 25118, daemon = TRUE)
# ------------------------------------------------------------
# IN A TERMINAL:
# curl -X GET http://127.0.0.1:25118/
# > Successful GET request!
# ------------------------------------------------------------
# Stop the beakr instance server
stopServer(beakr)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.