Created
May 9, 2022 20:21
-
-
Save Xevion/f27c1186898e3bfeee5185d1d98eb74f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(beakr) | |
# Create a new beakr server | |
newBeakr() %>% | |
# Respond to GET requests at the "/hi" route | |
httpGET(path = "/hi", function(req, res, err) { | |
print("Hello, World!") | |
}) %>% | |
# Respond to GET requests at the "/bye" route | |
httpGET(path = "/bye", function(req, res, err) { | |
print("Farewell, my friends.") | |
}) %>% | |
# Handle any errors with a JSON response | |
handleErrors() %>% | |
# Start the server on port 25118 | |
listen(host = "127.0.0.1", port = 25118) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment