Description Usage Arguments Value Examples
Create a Beakr
instance by calling the top-level
newBeakr()
function. If name
is not supplied, a random name
will be assigned.
This Beakr
instance will then begin a pipeline of separate middleware
steps for routing, serving files and handling errors. The pipeline will
end with the listen()
function.
1 |
name |
Optional name assigned to the |
A new and empty Beakr
instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | library(beakr)
# Create an new beakr instance
beakr <- newBeakr()
# beakr pipeline of hanldlers
beakr %>%
httpGET(path = "/route_A", function(res, req, err) {
print("This is route 'A'.")
}) %>%
httpGET(path = "/route_B", function(res, req, err) {
print("This is route 'B'.")
}) %>%
handleErrors() %>%
listen(host = '127.0.0.1', port = 25118, daemon = TRUE)
# ------------------------------------------------------------
# POINT YOUR BROWSER AT:
# * http://127.0.0.1:25118/route_A
# * http://127.0.0.1:25118/route_B
#
# THEN, STOP THE SERVER WITH stopServer(beakr)
# ------------------------------------------------------------
# Stop the beakr instance server
stopServer(beakr)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.