tower

Ergonomic middleware for Shiny applications

https://github.com/ixpantia/tower

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.0%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

Ergonomic middleware for Shiny applications

Basic Info
Statistics
  • Stars: 35
  • Watchers: 2
  • Forks: 3
  • Open Issues: 3
  • Releases: 1
Created about 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

tower

R-CMD-check <!-- badges: end -->

Dead simple middleware for R Shiny.

Summary

tower is a simple library for adding middleware to Shiny applications. It is inspired by the tower crate for Rust. It is designed to enable package authors and Shiny developers to extend Shiny a little bit more than what is usually possible.

You can use tower to add middlewares that forward, modify, or intercept requests in Shiny applications. This can be useful for adding logging, authentication, caching, or routing to your Shiny applications.

Installation

You can install the development version of tower from GitHub with:

``` r

install.packages("remotes")

remotes::install_github("ixpantia/tower") ```

Example

We may want to add a new route to our Shiny application that adds a count to a counter every time a user visits the route. We can do this with tower by adding a middleware that intercepts the request and increments the counter.

``` r library(shiny) library(tower)

Counter environment

globalcounter <- new.env() globalcounter$count <- 0

Middleware to increment the counter

incrementcounter <- function(req) { globalcounter$count <- globalcounter$count + 1 responsebuilder() |> addbody(paste("Counter is now", globalcounter$count)) |> build_response() }

A very empty Shiny app (not necesarry for the demo)

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

shinyApp(ui, server) |> createtower() |> addgetroute("/counter", incrementcounter) |> build_tower() ```

If you run the code above and visit the route /counter in your browser, you will see the counter increment every time you visit the route.

How it works

Basically, tower adds layers to a Shiny application. A layer is a function that takes a request and returns either a response or NULL. If a layer returns a response, the response is sent to the client and the request is not forwarded to the next layer. If a layer returns NULL, the request is forwarded to the next layer.

Owner

  • Name: ixpantia
  • Login: ixpantia
  • Kind: organization
  • Location: Costa Rica

GitHub Events

Total
  • Create event: 1
  • Release event: 1
  • Issues event: 1
  • Watch event: 19
  • Issue comment event: 1
  • Push event: 8
  • Pull request event: 5
  • Fork event: 2
Last Year
  • Create event: 1
  • Release event: 1
  • Issues event: 1
  • Watch event: 19
  • Issue comment event: 1
  • Push event: 8
  • Pull request event: 5
  • Fork event: 2

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 7
  • Total pull requests: 7
  • Average time to close issues: about 5 hours
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.14
  • Average comments per pull request: 0.0
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 minute
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • andyquinterom (6)
  • jimbrig (1)
Pull Request Authors
  • andyquinterom (10)
  • maurolepore (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 115 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: tower

Easy Middle Ware Library for 'shiny'

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 115 Last month
Rankings
Dependent packages count: 28.0%
Dependent repos count: 34.5%
Average: 49.8%
Downloads: 86.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • compiler * imports
  • shiny * suggests
  • stringr * suggests
  • testthat >= 3.0.0 suggests