pa <- api() |>
api_get("/", function() {
list(msg = "Hello World")
}) |>
api_on("start", function(...) {
cat("I'm alive")
})
# Start the server
pa |> api_run(block = FALSE)
# Stop it again
pa |> api_stop()
Run the code above in your browser using DataLab