| handler_directory | R Documentation |
Creates an HTTP handler that serves files from a directory tree. NNG handles MIME type detection automatically.
handler_directory(path, directory)
path |
URI path prefix (e.g., "/static"). Requests to "/static/foo.js" will serve "directory/foo.js". |
directory |
Path to the directory to serve. |
Directory handlers automatically match all paths under the prefix (prefix matching is implicit). The URI path is mapped to the filesystem:
Request to "/static/css/style.css" serves "directory/css/style.css"
Request to "/static/" serves "directory/index.html" if it exists
Note: The trailing slash behavior depends on how clients make requests.
A request to "/static" (no trailing slash) will not automatically redirect
to "/static/". Consider using handler_redirect() if you need this behavior.
A handler object for use with http_server().
h <- handler_directory("/static", "www/assets")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.