Created
October 6, 2020 12:57
-
-
Save JohnCoene/926d24536d3051a144e42047e5e306a5 to your computer and use it in GitHub Desktop.
Intro to HTTP requests with shiny
This file contains hidden or 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(shiny) | |
ui <- fluidPage( | |
uiOutput("intro") | |
) | |
server <- function(input, output, session){ | |
# serve the response | |
path <- session$registerDataObj( | |
name = "hello", | |
data = "<h1>Hello there!</h1>", | |
function(data, req) { | |
shiny:::httpResponse( | |
content = data | |
) | |
} | |
) | |
# print path | |
output$intro <- renderUI({ | |
# print so we can see the path clearly | |
print(path) | |
# print it big so we can see it | |
h1( | |
tags$a(path, href = path) | |
) | |
}) | |
} | |
shinyApp(ui, server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment