Live Data Table Viewer

function(input, output) {
  getData <- function() {
    # Replace with your GitHub raw CSV URL
    github_url <- "https://raw.githubusercontent.com/RobinKoetsier/temp/refs/heads/master/playerEredivisie.csv"
    
    response <- GET(github_url)
    data <- read_csv(rawToChar(response$content))
    return(toJSON(data))
  }
  
  # Create API endpoint
  router <- function(req) {
    if (req$REQUEST_METHOD == "GET" && req$PATH_INFO == "/data") {
      list(
        status = 200L,
        headers = list('Content-Type' = 'application/json'),
        body = getData()
      )
    }
  }
}