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.
at
The url path to serve the assets on
path
The path to the file or directory to serve
use_index
Should an index.html
file be served if present when a client requests the folder
fallthrough
Should requests that doesn't match a file enter the request loop or have a 404 response send directly
html_charset
The charset to report when serving html files
headers
A list of headers to add to the response.
validation
An optional validation pattern to compare to the request headers
except
One or more url paths that should be excluded from this route
name
An 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 )
at
The url path to listen to requests on
path
The path to the file or directory on the file system
use_index
Should an index.html
file be served if present when a
client requests the folder
fallthrough
Should requests that doesn't match a file enter the request loop or have a 404 response send directly
html_charset
The charset to report when serving html files
headers
A list of headers to add to the response. Will be combined with the global headers of the app
validation
A string for validating incoming requests. See httpuv::staticPath
except
One 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, ...)
app
The Fire object to attach the router to
on_error
A function for error handling
...
Ignored
clone()
The objects of this class are cloneable with this method.
AssetRoute$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.