Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch: handle continual processing of requests using httpuv #98

Merged

Conversation

kennedymwavu
Copy link
Contributor

closes #97

here's a minimal reprex for testing purposes:

devtools::load_all()
library(htmltools)

page_links <- \() {
  Map(
    f = \(href, label) {
      tags$a(href = href, label)
    },
    c("/", "/about", "/contact"),
    c("Home", "About", "Contact")
  )
}

home_get <- \(req, res) {
  html <- tagList(
    page_links(),
    tags$h3("hello, world!")
  )
  res$send(html)
}

about_get <- \(req, res) {
  html <- tagList(
    page_links(),
    tags$h3("About Us")
  )
  res$send(html)
}

contact_get <- \(req, res) {
  html <- tagList(
    page_links(),
    tags$h3("Get In Touch!")
  )
  res$send(html)
}

app <- Ambiorix$new()
app$get("/", home_get)
app$get("/about", about_get)
app$get("/contact", contact_get)
app$start()

@kennedymwavu kennedymwavu linked an issue Feb 3, 2025 that may be closed by this pull request
@JohnCoene
Copy link
Collaborator

LGTM

@JohnCoene JohnCoene merged commit d602a8a into master Feb 3, 2025
5 of 8 checks passed
@JohnCoene JohnCoene deleted the 97-let-httpuv-handle-keeping-r-alive-to-service-requests branch February 3, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

let {httpuv} handle "keeping R alive" to service requests
2 participants