Skip to content

Instantly share code, notes, and snippets.

@alekrutkowski
Created November 3, 2025 09:38
Show Gist options
  • Select an option

  • Save alekrutkowski/1ddadde02701b3908935f35fba7cd30e to your computer and use it in GitHub Desktop.

Select an option

Save alekrutkowski/1ddadde02701b3908935f35fba7cd30e to your computer and use it in GitHub Desktop.

Revisions

  1. alekrutkowski created this gist Nov 3, 2025.
    34 changes: 34 additions & 0 deletions app.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # Save it as /srv/shiny-server/your_app_name/app.R

    library(shiny)

    ui <- function(request) {
    query <- parseQueryString(request$QUERY_STRING)

    txt <- query$txt
    a <- as.numeric(query$a)
    b <- as.numeric(query$b)

    if (is.null(txt) || length(a)==0 || length(b)==0)
    httpResponse(
    status = 400,
    content_type = "text/plain; charset=UTF-8",
    content = 'One of the GET parameters (txt or a or b -- each case sensitive!) not provided!'
    ) else
    httpResponse(
    status = 200,
    content_type = "text/plain; charset=UTF-8",
    content = paste(toupper(txt),
    a + b,
    sep='\n')
    )
    }

    server <- function(input, output, session) {}

    shinyApp(ui = ui, server = server)

    # test:
    # https://localhost:8787/your_app_name/?txt=hello%20world&a=12&b=13
    # or
    # https://your.shinyserver.domain/your_app_name/?txt=hello%20world&a=12&b=13