| AssetRoute | R Documentation |
A class for serving files from the server directly. The AssetRoute is
fundamentally different than the other routes provided by routr. It is
specific to httpuv and circumvents the standard dispatch entirely (the
request never enters the R process). This makes it extremely fast but also
somewhat limited as you can't pass the request through any middleware.
atThe url path to serve the assets on
pathThe path to the file or directory to serve
use_indexShould an index.html file be served if present when a client requests the folder
fallthroughShould requests that doesn't match a file enter the request loop or have a 404 response send directly
html_charsetThe charset to report when serving html files
headersA list of headers to add to the response.
validationAn optional validation pattern to compare to the request headers
exceptOne or more url paths that should be excluded from this route
nameAn autogenerated name for the asset route
new()Create a new AssetRoute
AssetRoute$new( at, path, use_index = TRUE, fallthrough = FALSE, html_charset = "utf-8", headers = list(), validation = NULL, except = NULL )
atThe url path to listen to requests on
pathThe path to the file or directory on the file system
use_indexShould an index.html file be served if present when a
client requests the folder
fallthroughShould requests that doesn't match a file enter the request loop or have a 404 response send directly
html_charsetThe charset to report when serving html files
headersA list of headers to add to the response. Will be combined with the global headers of the app
validationA string for validating incoming requests. See httpuv::staticPath
exceptOne or more url paths that should be excluded from the
route. Requests matching these will enter the standard router dispatch.
The paths are interpreted as subpaths to at, e.g. the final path to
exclude will be at+exclude
print()Pretty printing of the object
AssetRoute$print(...)
...Ignored
on_attach()Method for use by fiery when attached as a plugin. Should
not be called directly. This method creates a RouteStack with the asset
route as the single route and then mounts that to the app. For more
flexibility create the RouteStack manually
AssetRoute$on_attach(app, on_error = NULL, ...)
appThe Fire object to attach the router to
on_errorA function for error handling
...Ignored
clone()The objects of this class are cloneable with this method.
AssetRoute$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.