diff --git a/authors.html b/authors.html index 6d27c3a..adcdfdc 100644 --- a/authors.html +++ b/authors.html @@ -52,11 +52,11 @@

Citation

Quintero A (2024). -tower: Easy Middle Ware Library for Shiny. +tower: Easy Middle Ware Library for 'shiny'. R package version 0.1.0.

@Manual{,
-  title = {tower: Easy Middle Ware Library for Shiny},
+  title = {tower: Easy Middle Ware Library for 'shiny'},
   author = {Andres Quintero},
   year = {2024},
   note = {R package version 0.1.0},
diff --git a/index.html b/index.html
index 93219bb..960bd3a 100644
--- a/index.html
+++ b/index.html
@@ -5,20 +5,20 @@
 
 
 
-
-Easy Middle Ware Library for Shiny • tower
+Easy Middle Ware Library for shiny • tower
 
 
 
 
-
-
+
 Add a body to a response — add_body • tower
+    Skip to contents
+    
+
+    
+
+
+ +
+

Adds a body to a response, if no content type is set, it will be detected

+
+ +
+

Usage

+
add_body(res, body)
+
+ +
+

Arguments

+
res
+

A response builder object

+ + +
body
+

The body to add

+ +
+
+

Value

+ + +

The response builder object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_body_json.html b/reference/add_body_json.html new file mode 100644 index 0000000..2d422cf --- /dev/null +++ b/reference/add_body_json.html @@ -0,0 +1,84 @@ + +Add a body to a response as JSON — add_body_json • tower + Skip to contents + + +
+
+
+ +
+

Adds a body to a response as JSON

+
+ +
+

Usage

+
add_body_json(res, body)
+
+ +
+

Arguments

+
res
+

A response builder object

+ + +
body
+

The body to add

+ +
+
+

Value

+ + +

The response builder object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_cookie.html b/reference/add_cookie.html new file mode 100644 index 0000000..bf4e4fe --- /dev/null +++ b/reference/add_cookie.html @@ -0,0 +1,88 @@ + +Add a cookie to a response — add_cookie • tower + Skip to contents + + +
+
+
+ +
+

Adds a cookie to a response

+
+ +
+

Usage

+
add_cookie(res, name, value)
+
+ +
+

Arguments

+
res
+

A response builder object

+ + +
name
+

The name of the cookie

+ + +
value
+

The value of the cookie

+ +
+
+

Value

+ + +

The response builder object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_delete_route.html b/reference/add_delete_route.html new file mode 100644 index 0000000..d3f64eb --- /dev/null +++ b/reference/add_delete_route.html @@ -0,0 +1,88 @@ + +Add a DELETE route — add_delete_route • tower + Skip to contents + + +
+
+
+ +
+

Adds a DELETE route to a tower

+
+ +
+

Usage

+
add_delete_route(tower, path, handler)
+
+ +
+

Arguments

+
tower
+

A tower object

+ + +
path
+

A string containing the path to match

+ + +
handler
+

A function to call when the route is matched

+ +
+
+

Value

+ + +

A tower object with the route added

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_get_route.html b/reference/add_get_route.html new file mode 100644 index 0000000..5d080c6 --- /dev/null +++ b/reference/add_get_route.html @@ -0,0 +1,88 @@ + +Add a GET route — add_get_route • tower + Skip to contents + + +
+
+
+ +
+

Adds a GET route to a tower

+
+ +
+

Usage

+
add_get_route(tower, path, handler)
+
+ +
+

Arguments

+
tower
+

A tower object

+ + +
path
+

A string containing the path to match

+ + +
handler
+

A function to call when the route is matched

+ +
+
+

Value

+ + +

A tower object with the route added

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_http_layer.html b/reference/add_http_layer.html index 00a54a1..983320e 100644 --- a/reference/add_http_layer.html +++ b/reference/add_http_layer.html @@ -1,7 +1,7 @@ Add an HTTP layer to a tower — add_http_layer • tower @@ -40,7 +40,7 @@

Add an HTTP layer to a tower. This layer -will be called before the Shiny app's httpHandler.

+will be called before the 'shiny' app's httpHandler.

diff --git a/reference/add_patch_route.html b/reference/add_patch_route.html new file mode 100644 index 0000000..dc42d6e --- /dev/null +++ b/reference/add_patch_route.html @@ -0,0 +1,88 @@ + +Add a PATCH route — add_patch_route • tower + Skip to contents + + +
+
+
+ +
+

Adds a PATCH route to a tower

+
+ +
+

Usage

+
add_patch_route(tower, path, handler)
+
+ +
+

Arguments

+
tower
+

A tower object

+ + +
path
+

A string containing the path to match

+ + +
handler
+

A function to call when the route is matched

+ +
+
+

Value

+ + +

A tower object with the route added

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_post_route.html b/reference/add_post_route.html new file mode 100644 index 0000000..11664db --- /dev/null +++ b/reference/add_post_route.html @@ -0,0 +1,88 @@ + +Add a POST route — add_post_route • tower + Skip to contents + + +
+
+
+ +
+

Adds a POST route to a tower

+
+ +
+

Usage

+
add_post_route(tower, path, handler)
+
+ +
+

Arguments

+
tower
+

A tower object

+ + +
path
+

A string containing the path to match

+ + +
handler
+

A function to call when the route is matched

+ +
+
+

Value

+ + +

A tower object with the route added

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_put_route.html b/reference/add_put_route.html new file mode 100644 index 0000000..004b6cc --- /dev/null +++ b/reference/add_put_route.html @@ -0,0 +1,88 @@ + +Add a PUT route — add_put_route • tower + Skip to contents + + +
+
+
+ +
+

Adds a PUT route to a tower

+
+ +
+

Usage

+
add_put_route(tower, path, handler)
+
+ +
+

Arguments

+
tower
+

A tower object

+ + +
path
+

A string containing the path to match

+ + +
handler
+

A function to call when the route is matched

+ +
+
+

Value

+ + +

A tower object with the route added

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_route.html b/reference/add_route.html new file mode 100644 index 0000000..fbfeb6f --- /dev/null +++ b/reference/add_route.html @@ -0,0 +1,92 @@ + +Add an HTTP layer to a tower — add_route • tower + Skip to contents + + +
+
+
+ +
+

Adds an HTTP layer to a tower

+
+ +
+

Usage

+
add_route(tower, method = "GET", path, handler)
+
+ +
+

Arguments

+
tower
+

A tower object

+ + +
method
+

A string containing the HTTP method to match

+ + +
path
+

A string containing the path to match

+ + +
handler
+

A function to call when the layer is matched

+ +
+
+

Value

+ + +

A tower object with the layer added

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/add_server_layer.html b/reference/add_server_layer.html index 33dd2cd..6832486 100644 --- a/reference/add_server_layer.html +++ b/reference/add_server_layer.html @@ -1,9 +1,9 @@ Add a server layer to a tower — add_server_layer • towerBuild a cookie — build_http_cookie • tower + Skip to contents + + +
+
+
+ +
+

Builds an HttpOnly cookie from a key and value

+
+ +
+

Usage

+
build_http_cookie(key, value)
+
+ +
+

Arguments

+
key
+

A string containing the cookie key

+ + +
value
+

A string containing the cookie value

+ +
+
+

Value

+ + +

A string containing the cookie

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/build_response.html b/reference/build_response.html new file mode 100644 index 0000000..ea03faf --- /dev/null +++ b/reference/build_response.html @@ -0,0 +1,80 @@ + +Build a response — build_response • tower + Skip to contents + + +
+
+
+ +
+

Builds a response

+
+ +
+

Usage

+
build_response(res)
+
+ +
+

Arguments

+
res
+

A response builder object

+ +
+
+

Value

+ + +

A response object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/build_tower.html b/reference/build_tower.html index cb15c07..1489fa5 100644 --- a/reference/build_tower.html +++ b/reference/build_tower.html @@ -1,7 +1,7 @@ -Build a Shiny app from a tower — build_tower • towerBuild a 'shiny' app from a tower — build_tower • tower @@ -33,14 +33,14 @@
-

Build a Shiny app from a tower. This will create -a new Shiny app with the specified layers added.

+

Build a 'shiny' app from a tower. This will create +a new 'shiny' app with the specified layers added.

@@ -58,7 +58,7 @@

ArgumentsValue

-

A Shiny app object

+

A 'shiny' app object that can be started

diff --git a/reference/parse_cookies.html b/reference/parse_cookies.html new file mode 100644 index 0000000..1e669ff --- /dev/null +++ b/reference/parse_cookies.html @@ -0,0 +1,80 @@ + +Parse cookies — parse_cookies • tower + Skip to contents + + +
+
+
+ +
+

Parses cookies from a string

+
+ +
+

Usage

+
parse_cookies(x)
+
+ +
+

Arguments

+
x
+

A string containing the cookies

+ +
+
+

Value

+ + +

A list containing the cookies

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/req_body_form.html b/reference/req_body_form.html new file mode 100644 index 0000000..d415682 --- /dev/null +++ b/reference/req_body_form.html @@ -0,0 +1,80 @@ + +Extract form data from a request — req_body_form • tower + Skip to contents + + +
+
+
+ +
+

Extracts form data from a request

+
+ +
+

Usage

+
req_body_form(req)
+
+ +
+

Arguments

+
req
+

A request object

+ +
+
+

Value

+ + +

A list containing the form data

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/req_body_json.html b/reference/req_body_json.html new file mode 100644 index 0000000..95ca02b --- /dev/null +++ b/reference/req_body_json.html @@ -0,0 +1,86 @@ + +Extract the request body from a JSON request — req_body_json • tower + Skip to contents + + +
+
+
+ +
+

Extracts the request body from a JSON request

+
+ +
+

Usage

+
req_body_json(req, ...)
+
+ +
+

Arguments

+
req
+

A request object

+ + +
...
+

Additional arguments to pass to fromJSON +when parsing the request body. This will only be used the first time the +request body is parsed. Subsequent calls will return the cached result.

+ +
+
+

Value

+ + +

A list containing the request body

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/req_cookies.html b/reference/req_cookies.html new file mode 100644 index 0000000..9815775 --- /dev/null +++ b/reference/req_cookies.html @@ -0,0 +1,80 @@ + +Extract cookies from a request — req_cookies • tower + Skip to contents + + +
+
+
+ +
+

Extracts cookies from a request

+
+ +
+

Usage

+
req_cookies(req)
+
+ +
+

Arguments

+
req
+

A request object

+ +
+
+

Value

+ + +

A list containing the cookies

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/req_query.html b/reference/req_query.html new file mode 100644 index 0000000..9ee2b03 --- /dev/null +++ b/reference/req_query.html @@ -0,0 +1,80 @@ + +Extract query parameters from a request — req_query • tower + Skip to contents + + +
+
+
+ +
+

Extracts query parameters from a request

+
+ +
+

Usage

+
req_query(req)
+
+ +
+

Arguments

+
req
+

A request object

+ +
+
+

Value

+ + +

A list containing the query parameters

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/response_builder.html b/reference/response_builder.html new file mode 100644 index 0000000..fa44fb2 --- /dev/null +++ b/reference/response_builder.html @@ -0,0 +1,74 @@ + +Create a response builder — response_builder • tower + Skip to contents + + +
+
+
+ +
+

Creates a response builder

+
+ +
+

Usage

+
response_builder()
+
+ +
+

Value

+ + +

A response builder object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/set_content_type.html b/reference/set_content_type.html new file mode 100644 index 0000000..0de763e --- /dev/null +++ b/reference/set_content_type.html @@ -0,0 +1,84 @@ + +Set the content type of a response — set_content_type • tower + Skip to contents + + +
+
+
+ +
+

Sets the content type of a response

+
+ +
+

Usage

+
set_content_type(res, content_type)
+
+ +
+

Arguments

+
res
+

A response builder object

+ + +
content_type
+

The content type to set

+ +
+
+

Value

+ + +

The response builder object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/set_header.html b/reference/set_header.html new file mode 100644 index 0000000..6d4143f --- /dev/null +++ b/reference/set_header.html @@ -0,0 +1,88 @@ + +Set a header on a response — set_header • tower + Skip to contents + + +
+
+
+ +
+

Sets or adds a header to a response

+
+ +
+

Usage

+
set_header(res, name, value)
+
+ +
+

Arguments

+
res
+

A response builder object

+ + +
name
+

The name of the header

+ + +
value
+

The value of the header

+ +
+
+

Value

+ + +

The response builder object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/reference/set_status.html b/reference/set_status.html new file mode 100644 index 0000000..7432e3e --- /dev/null +++ b/reference/set_status.html @@ -0,0 +1,84 @@ + +Set the status of a response — set_status • tower + Skip to contents + + +
+
+
+ +
+

Sets the status of a response

+
+ +
+

Usage

+
set_status(res, status)
+
+ +
+

Arguments

+
res
+

A response builder object

+ + +
status
+

The status to set

+ +
+
+

Value

+ + +

The response builder object

+
+ +
+ + +
+ + + +
+ + + + + + + diff --git a/search.json b/search.json index 75d31e9..ff986b2 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 tower authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"ixpantia, SRL. Copyright holder. Andres Quintero. Author, maintainer.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Quintero (2024). tower: Easy Middle Ware Library Shiny. R package version 0.1.0.","code":"@Manual{, title = {tower: Easy Middle Ware Library for Shiny}, author = {Andres Quintero}, year = {2024}, note = {R package version 0.1.0}, }"},{"path":"/index.html","id":"tower","dir":"","previous_headings":"","what":"Easy Middle Ware Library for Shiny","title":"Easy Middle Ware Library for Shiny","text":"Dead simple middleware R Shiny.","code":""},{"path":"/index.html","id":"summary","dir":"","previous_headings":"","what":"Summary","title":"Easy Middle Ware Library for Shiny","text":"tower simple library adding middleware Shiny applications. inspired tower crate Rust. designed enable package authors Shiny developers extend Shiny little bit usually possible. can use tower add middlewares forward, modify, intercept requests Shiny applications. can useful adding logging, authentication, caching, routing Shiny applications.","code":""},{"path":"/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Easy Middle Ware Library for Shiny","text":"can install development version tower GitHub :","code":"# install.packages(\"remotes\") remotes::install_github(\"ixpantia/tower\")"},{"path":"/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Easy Middle Ware Library for Shiny","text":"may want add new route Shiny application adds count counter every time user visits route. can tower adding middleware intercepts request increments counter. run code visit route /increment browser, see counter increment every time visit route.","code":"library(shiny) library(tower) # Counter environment COUNTER <- new.env() COUNTER$counter <- 0 # Middleware to increment the counter increment_counter <- function(req) { if (req$PATH_INFO == \"/increment\") { COUNTER$counter <- COUNTER$counter + 1 return( httpResponse( 200, \"text/plain\", paste(\"Counter is now\", COUNTER$counter) ) ) } } # A very empty Shiny app (not necessary for the demo) ui <- fluidPage() server <- function(input, output, session) {} shinyApp(ui, server) |> create_tower() |> add_http_layer(increment_counter) |> build_tower()"},{"path":"/index.html","id":"how-it-works","dir":"","previous_headings":"","what":"How it works","title":"Easy Middle Ware Library for Shiny","text":"Basically, tower adds layers Shiny application. layer function takes request returns either response NULL. layer returns response, response sent client request forwarded next layer. layer returns NULL, request forwarded next layer.","code":""},{"path":"/reference/add_http_layer.html","id":null,"dir":"Reference","previous_headings":"","what":"Add an HTTP layer to a tower — add_http_layer","title":"Add an HTTP layer to a tower — add_http_layer","text":"Add HTTP layer tower. layer called Shiny app's httpHandler.","code":""},{"path":"/reference/add_http_layer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add an HTTP layer to a tower — add_http_layer","text":"","code":"add_http_layer(tower, layer)"},{"path":"/reference/add_http_layer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add an HTTP layer to a tower — add_http_layer","text":"tower tower layer function takes request returns either response NULL. NULL indicates layer short-circuit request, therefore next layer called. response returned, request short-circuited response returned client.","code":""},{"path":"/reference/add_http_layer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add an HTTP layer to a tower — add_http_layer","text":"tower layer added","code":""},{"path":"/reference/add_server_layer.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a server layer to a tower — add_server_layer","title":"Add a server layer to a tower — add_server_layer","text":"Add server layer tower. layer run Shiny app's server function. useful adding custom logic server function without modifying original server function.","code":""},{"path":"/reference/add_server_layer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a server layer to a tower — add_server_layer","text":"","code":"add_server_layer(tower, layer)"},{"path":"/reference/add_server_layer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a server layer to a tower — add_server_layer","text":"tower tower layer function takes input, output, session return value. function called original server function. want short-circuit server use exception.","code":""},{"path":"/reference/add_server_layer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a server layer to a tower — add_server_layer","text":"tower layer added","code":""},{"path":"/reference/app_into_parts.html","id":null,"dir":"Reference","previous_headings":"","what":"Into parts — app_into_parts","title":"Into parts — app_into_parts","text":"Splits shiny.appobj parts, ui server","code":""},{"path":"/reference/app_into_parts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Into parts — app_into_parts","text":"","code":"app_into_parts(app)"},{"path":"/reference/app_into_parts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Into parts — app_into_parts","text":"app shiny.appobj","code":""},{"path":"/reference/app_into_parts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Into parts — app_into_parts","text":"list ui server handlers","code":""},{"path":"/reference/build_tower.html","id":null,"dir":"Reference","previous_headings":"","what":"Build a Shiny app from a tower — build_tower","title":"Build a Shiny app from a tower — build_tower","text":"Build Shiny app tower. create new Shiny app specified layers added.","code":""},{"path":"/reference/build_tower.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build a Shiny app from a tower — build_tower","text":"","code":"build_tower(tower)"},{"path":"/reference/build_tower.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build a Shiny app from a tower — build_tower","text":"tower tower","code":""},{"path":"/reference/build_tower.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Build a Shiny app from a tower — build_tower","text":"Shiny app object","code":""},{"path":"/reference/create_tower.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new tower — create_tower","title":"Create a new tower — create_tower","text":"Create new tower build upon.","code":""},{"path":"/reference/create_tower.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new tower — create_tower","text":"","code":"create_tower(app)"},{"path":"/reference/create_tower.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new tower — create_tower","text":"app shiny app object","code":""},{"path":"/reference/create_tower.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a new tower — create_tower","text":"new tower","code":""},{"path":"/reference/print.tower.html","id":null,"dir":"Reference","previous_headings":"","what":"Print a tower — print.tower","title":"Print a tower — print.tower","text":"Print tower","code":""},{"path":"/reference/print.tower.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print a tower — print.tower","text":"","code":"# S3 method for tower print(x, ...)"},{"path":"/reference/print.tower.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print a tower — print.tower","text":"x tower ... Ignored arguments (compatibility print)","code":""}] +[{"path":"/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 tower authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"ixpantia, SRL. Copyright holder. Andres Quintero. Author, maintainer.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Quintero (2024). tower: Easy Middle Ware Library 'shiny'. R package version 0.1.0.","code":"@Manual{, title = {tower: Easy Middle Ware Library for 'shiny'}, author = {Andres Quintero}, year = {2024}, note = {R package version 0.1.0}, }"},{"path":"/index.html","id":"tower","dir":"","previous_headings":"","what":"Easy Middle Ware Library for shiny","title":"Easy Middle Ware Library for shiny","text":"Dead simple middleware R Shiny.","code":""},{"path":"/index.html","id":"summary","dir":"","previous_headings":"","what":"Summary","title":"Easy Middle Ware Library for shiny","text":"tower simple library adding middleware Shiny applications. inspired tower crate Rust. designed enable package authors Shiny developers extend Shiny little bit usually possible. can use tower add middlewares forward, modify, intercept requests Shiny applications. can useful adding logging, authentication, caching, routing Shiny applications.","code":""},{"path":"/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Easy Middle Ware Library for shiny","text":"can install development version tower GitHub :","code":"# install.packages(\"remotes\") remotes::install_github(\"ixpantia/tower\")"},{"path":"/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Easy Middle Ware Library for shiny","text":"may want add new route Shiny application adds count counter every time user visits route. can tower adding middleware intercepts request increments counter. run code visit route /counter browser, see counter increment every time visit route.","code":"library(shiny) library(tower) # Counter environment global_counter <- new.env() global_counter$count <- 0 # Middleware to increment the counter increment_counter <- function(req) { global_counter$count <- global_counter$count + 1 response_builder() |> add_body(paste(\"Counter is now\", global_counter$count)) |> build_response() } # A very empty Shiny app (not necesarry for the demo) ui <- fluidPage() server <- function(input, output, session) {} shinyApp(ui, server) |> create_tower() |> add_get_route(\"/counter\", increment_counter) |> build_tower()"},{"path":"/index.html","id":"how-it-works","dir":"","previous_headings":"","what":"How it works","title":"Easy Middle Ware Library for shiny","text":"Basically, tower adds layers Shiny application. layer function takes request returns either response NULL. layer returns response, response sent client request forwarded next layer. layer returns NULL, request forwarded next layer.","code":""},{"path":"/reference/add_body.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a body to a response — add_body","title":"Add a body to a response — add_body","text":"Adds body response, content type set, detected","code":""},{"path":"/reference/add_body.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a body to a response — add_body","text":"","code":"add_body(res, body)"},{"path":"/reference/add_body.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a body to a response — add_body","text":"res response builder object body body add","code":""},{"path":"/reference/add_body.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a body to a response — add_body","text":"response builder object","code":""},{"path":"/reference/add_body_json.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a body to a response as JSON — add_body_json","title":"Add a body to a response as JSON — add_body_json","text":"Adds body response JSON","code":""},{"path":"/reference/add_body_json.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a body to a response as JSON — add_body_json","text":"","code":"add_body_json(res, body)"},{"path":"/reference/add_body_json.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a body to a response as JSON — add_body_json","text":"res response builder object body body add","code":""},{"path":"/reference/add_body_json.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a body to a response as JSON — add_body_json","text":"response builder object","code":""},{"path":"/reference/add_cookie.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a cookie to a response — add_cookie","title":"Add a cookie to a response — add_cookie","text":"Adds cookie response","code":""},{"path":"/reference/add_cookie.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a cookie to a response — add_cookie","text":"","code":"add_cookie(res, name, value)"},{"path":"/reference/add_cookie.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a cookie to a response — add_cookie","text":"res response builder object name name cookie value value cookie","code":""},{"path":"/reference/add_cookie.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a cookie to a response — add_cookie","text":"response builder object","code":""},{"path":"/reference/add_delete_route.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a DELETE route — add_delete_route","title":"Add a DELETE route — add_delete_route","text":"Adds DELETE route tower","code":""},{"path":"/reference/add_delete_route.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a DELETE route — add_delete_route","text":"","code":"add_delete_route(tower, path, handler)"},{"path":"/reference/add_delete_route.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a DELETE route — add_delete_route","text":"tower tower object path string containing path match handler function call route matched","code":""},{"path":"/reference/add_delete_route.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a DELETE route — add_delete_route","text":"tower object route added","code":""},{"path":"/reference/add_get_route.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a GET route — add_get_route","title":"Add a GET route — add_get_route","text":"Adds GET route tower","code":""},{"path":"/reference/add_get_route.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a GET route — add_get_route","text":"","code":"add_get_route(tower, path, handler)"},{"path":"/reference/add_get_route.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a GET route — add_get_route","text":"tower tower object path string containing path match handler function call route matched","code":""},{"path":"/reference/add_get_route.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a GET route — add_get_route","text":"tower object route added","code":""},{"path":"/reference/add_http_layer.html","id":null,"dir":"Reference","previous_headings":"","what":"Add an HTTP layer to a tower — add_http_layer","title":"Add an HTTP layer to a tower — add_http_layer","text":"Add HTTP layer tower. layer called 'shiny' app's httpHandler.","code":""},{"path":"/reference/add_http_layer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add an HTTP layer to a tower — add_http_layer","text":"","code":"add_http_layer(tower, layer)"},{"path":"/reference/add_http_layer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add an HTTP layer to a tower — add_http_layer","text":"tower tower layer function takes request returns either response NULL. NULL indicates layer short-circuit request, therefore next layer called. response returned, request short-circuited response returned client.","code":""},{"path":"/reference/add_http_layer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add an HTTP layer to a tower — add_http_layer","text":"tower layer added","code":""},{"path":"/reference/add_patch_route.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a PATCH route — add_patch_route","title":"Add a PATCH route — add_patch_route","text":"Adds PATCH route tower","code":""},{"path":"/reference/add_patch_route.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a PATCH route — add_patch_route","text":"","code":"add_patch_route(tower, path, handler)"},{"path":"/reference/add_patch_route.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a PATCH route — add_patch_route","text":"tower tower object path string containing path match handler function call route matched","code":""},{"path":"/reference/add_patch_route.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a PATCH route — add_patch_route","text":"tower object route added","code":""},{"path":"/reference/add_post_route.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a POST route — add_post_route","title":"Add a POST route — add_post_route","text":"Adds POST route tower","code":""},{"path":"/reference/add_post_route.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a POST route — add_post_route","text":"","code":"add_post_route(tower, path, handler)"},{"path":"/reference/add_post_route.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a POST route — add_post_route","text":"tower tower object path string containing path match handler function call route matched","code":""},{"path":"/reference/add_post_route.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a POST route — add_post_route","text":"tower object route added","code":""},{"path":"/reference/add_put_route.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a PUT route — add_put_route","title":"Add a PUT route — add_put_route","text":"Adds PUT route tower","code":""},{"path":"/reference/add_put_route.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a PUT route — add_put_route","text":"","code":"add_put_route(tower, path, handler)"},{"path":"/reference/add_put_route.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a PUT route — add_put_route","text":"tower tower object path string containing path match handler function call route matched","code":""},{"path":"/reference/add_put_route.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a PUT route — add_put_route","text":"tower object route added","code":""},{"path":"/reference/add_route.html","id":null,"dir":"Reference","previous_headings":"","what":"Add an HTTP layer to a tower — add_route","title":"Add an HTTP layer to a tower — add_route","text":"Adds HTTP layer tower","code":""},{"path":"/reference/add_route.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add an HTTP layer to a tower — add_route","text":"","code":"add_route(tower, method = \"GET\", path, handler)"},{"path":"/reference/add_route.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add an HTTP layer to a tower — add_route","text":"tower tower object method string containing HTTP method match path string containing path match handler function call layer matched","code":""},{"path":"/reference/add_route.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add an HTTP layer to a tower — add_route","text":"tower object layer added","code":""},{"path":"/reference/add_server_layer.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a server layer to a tower — add_server_layer","title":"Add a server layer to a tower — add_server_layer","text":"Add server layer tower. layer run 'shiny' app's server function. useful adding custom logic server function without modifying original server function.","code":""},{"path":"/reference/add_server_layer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a server layer to a tower — add_server_layer","text":"","code":"add_server_layer(tower, layer)"},{"path":"/reference/add_server_layer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a server layer to a tower — add_server_layer","text":"tower tower layer function takes input, output, session return value. function called original server function. want short-circuit server use exception.","code":""},{"path":"/reference/add_server_layer.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a server layer to a tower — add_server_layer","text":"tower layer added","code":""},{"path":"/reference/app_into_parts.html","id":null,"dir":"Reference","previous_headings":"","what":"Into parts — app_into_parts","title":"Into parts — app_into_parts","text":"Splits shiny.appobj parts, ui server","code":""},{"path":"/reference/app_into_parts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Into parts — app_into_parts","text":"","code":"app_into_parts(app)"},{"path":"/reference/app_into_parts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Into parts — app_into_parts","text":"app shiny.appobj","code":""},{"path":"/reference/app_into_parts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Into parts — app_into_parts","text":"list ui server handlers","code":""},{"path":"/reference/build_http_cookie.html","id":null,"dir":"Reference","previous_headings":"","what":"Build a cookie — build_http_cookie","title":"Build a cookie — build_http_cookie","text":"Builds HttpOnly cookie key value","code":""},{"path":"/reference/build_http_cookie.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build a cookie — build_http_cookie","text":"","code":"build_http_cookie(key, value)"},{"path":"/reference/build_http_cookie.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build a cookie — build_http_cookie","text":"key string containing cookie key value string containing cookie value","code":""},{"path":"/reference/build_http_cookie.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Build a cookie — build_http_cookie","text":"string containing cookie","code":""},{"path":"/reference/build_response.html","id":null,"dir":"Reference","previous_headings":"","what":"Build a response — build_response","title":"Build a response — build_response","text":"Builds response","code":""},{"path":"/reference/build_response.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build a response — build_response","text":"","code":"build_response(res)"},{"path":"/reference/build_response.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build a response — build_response","text":"res response builder object","code":""},{"path":"/reference/build_response.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Build a response — build_response","text":"response object","code":""},{"path":"/reference/build_tower.html","id":null,"dir":"Reference","previous_headings":"","what":"Build a 'shiny' app from a tower — build_tower","title":"Build a 'shiny' app from a tower — build_tower","text":"Build 'shiny' app tower. create new 'shiny' app specified layers added.","code":""},{"path":"/reference/build_tower.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build a 'shiny' app from a tower — build_tower","text":"","code":"build_tower(tower)"},{"path":"/reference/build_tower.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build a 'shiny' app from a tower — build_tower","text":"tower tower","code":""},{"path":"/reference/build_tower.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Build a 'shiny' app from a tower — build_tower","text":"'shiny' app object can started","code":""},{"path":"/reference/create_tower.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new tower — create_tower","title":"Create a new tower — create_tower","text":"Create new tower build upon.","code":""},{"path":"/reference/create_tower.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new tower — create_tower","text":"","code":"create_tower(app)"},{"path":"/reference/create_tower.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new tower — create_tower","text":"app 'shiny' app object","code":""},{"path":"/reference/create_tower.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a new tower — create_tower","text":"new tower","code":""},{"path":"/reference/parse_cookies.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse cookies — parse_cookies","title":"Parse cookies — parse_cookies","text":"Parses cookies string","code":""},{"path":"/reference/parse_cookies.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse cookies — parse_cookies","text":"","code":"parse_cookies(x)"},{"path":"/reference/parse_cookies.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse cookies — parse_cookies","text":"x string containing cookies","code":""},{"path":"/reference/parse_cookies.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse cookies — parse_cookies","text":"list containing cookies","code":""},{"path":"/reference/print.tower.html","id":null,"dir":"Reference","previous_headings":"","what":"Print a tower — print.tower","title":"Print a tower — print.tower","text":"Print tower","code":""},{"path":"/reference/print.tower.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print a tower — print.tower","text":"","code":"# S3 method for tower print(x, ...)"},{"path":"/reference/print.tower.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print a tower — print.tower","text":"x tower ... Ignored arguments (compatibility print)","code":""},{"path":"/reference/req_body_form.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract form data from a request — req_body_form","title":"Extract form data from a request — req_body_form","text":"Extracts form data request","code":""},{"path":"/reference/req_body_form.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract form data from a request — req_body_form","text":"","code":"req_body_form(req)"},{"path":"/reference/req_body_form.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract form data from a request — req_body_form","text":"req request object","code":""},{"path":"/reference/req_body_form.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract form data from a request — req_body_form","text":"list containing form data","code":""},{"path":"/reference/req_body_json.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract the request body from a JSON request — req_body_json","title":"Extract the request body from a JSON request — req_body_json","text":"Extracts request body JSON request","code":""},{"path":"/reference/req_body_json.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract the request body from a JSON request — req_body_json","text":"","code":"req_body_json(req, ...)"},{"path":"/reference/req_body_json.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract the request body from a JSON request — req_body_json","text":"req request object ... Additional arguments pass fromJSON parsing request body. used first time request body parsed. Subsequent calls return cached result.","code":""},{"path":"/reference/req_body_json.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract the request body from a JSON request — req_body_json","text":"list containing request body","code":""},{"path":"/reference/req_cookies.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract cookies from a request — req_cookies","title":"Extract cookies from a request — req_cookies","text":"Extracts cookies request","code":""},{"path":"/reference/req_cookies.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract cookies from a request — req_cookies","text":"","code":"req_cookies(req)"},{"path":"/reference/req_cookies.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract cookies from a request — req_cookies","text":"req request object","code":""},{"path":"/reference/req_cookies.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract cookies from a request — req_cookies","text":"list containing cookies","code":""},{"path":"/reference/req_query.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract query parameters from a request — req_query","title":"Extract query parameters from a request — req_query","text":"Extracts query parameters request","code":""},{"path":"/reference/req_query.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract query parameters from a request — req_query","text":"","code":"req_query(req)"},{"path":"/reference/req_query.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract query parameters from a request — req_query","text":"req request object","code":""},{"path":"/reference/req_query.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract query parameters from a request — req_query","text":"list containing query parameters","code":""},{"path":"/reference/response_builder.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a response builder — response_builder","title":"Create a response builder — response_builder","text":"Creates response builder","code":""},{"path":"/reference/response_builder.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a response builder — response_builder","text":"","code":"response_builder()"},{"path":"/reference/response_builder.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a response builder — response_builder","text":"response builder object","code":""},{"path":"/reference/set_content_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the content type of a response — set_content_type","title":"Set the content type of a response — set_content_type","text":"Sets content type response","code":""},{"path":"/reference/set_content_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the content type of a response — set_content_type","text":"","code":"set_content_type(res, content_type)"},{"path":"/reference/set_content_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the content type of a response — set_content_type","text":"res response builder object content_type content type set","code":""},{"path":"/reference/set_content_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the content type of a response — set_content_type","text":"response builder object","code":""},{"path":"/reference/set_header.html","id":null,"dir":"Reference","previous_headings":"","what":"Set a header on a response — set_header","title":"Set a header on a response — set_header","text":"Sets adds header response","code":""},{"path":"/reference/set_header.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set a header on a response — set_header","text":"","code":"set_header(res, name, value)"},{"path":"/reference/set_header.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set a header on a response — set_header","text":"res response builder object name name header value value header","code":""},{"path":"/reference/set_header.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set a header on a response — set_header","text":"response builder object","code":""},{"path":"/reference/set_status.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the status of a response — set_status","title":"Set the status of a response — set_status","text":"Sets status response","code":""},{"path":"/reference/set_status.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the status of a response — set_status","text":"","code":"set_status(res, status)"},{"path":"/reference/set_status.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set the status of a response — set_status","text":"res response builder object status status set","code":""},{"path":"/reference/set_status.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the status of a response — set_status","text":"response builder object","code":""}] diff --git a/sitemap.xml b/sitemap.xml index 3152787..9511b7b 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -15,15 +15,48 @@ /index.html + + /reference/add_body.html + + + /reference/add_body_json.html + + + /reference/add_cookie.html + + + /reference/add_delete_route.html + + + /reference/add_get_route.html + /reference/add_http_layer.html + + /reference/add_patch_route.html + + + /reference/add_post_route.html + + + /reference/add_put_route.html + + + /reference/add_route.html + /reference/add_server_layer.html /reference/app_into_parts.html + + /reference/build_http_cookie.html + + + /reference/build_response.html + /reference/build_tower.html @@ -33,7 +66,34 @@ /reference/index.html + + /reference/parse_cookies.html + /reference/print.tower.html + + /reference/req_body_form.html + + + /reference/req_body_json.html + + + /reference/req_cookies.html + + + /reference/req_query.html + + + /reference/response_builder.html + + + /reference/set_content_type.html + + + /reference/set_header.html + + + /reference/set_status.html +