Debian Codegraph @

man/resourcePaths.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/server-resource-paths.R
3 \name{addResourcePath}
4 \alias{addResourcePath}
5 \alias{resourcePaths}
6 \alias{removeResourcePath}
7 \title{Resource Publishing}
8 \usage{
9 addResourcePath(prefix, directoryPath)
10
11 resourcePaths()
12
13 removeResourcePath(prefix)
14 }
15 \arguments{
16 \item{prefix}{The URL prefix (without slashes). Valid characters are a-z,
17 A-Z, 0-9, hyphen, period, and underscore. For example, a value of 'foo'
18 means that any request paths that begin with '/foo' will be mapped to the
19 given directory.}
20
21 \item{directoryPath}{The directory that contains the static resources to be
22 served.}
23 }
24 \description{
25 Add, remove, or list directory of static resources to Shiny's web server,
26 with the given path prefix. Primarily intended for package authors to make
27 supporting JavaScript/CSS files available to their components.
28 }
29 \details{
30 Shiny provides two ways of serving static files (i.e., resources):
31 \enumerate{
32 \item Static files under the \verb{www/} directory are automatically made available
33 under a request path that begins with \code{/}.
34 \item \code{addResourcePath()} makes static files in a \code{directoryPath} available
35 under a request path that begins with \code{prefix}.
36 }
37
38 The second approach is primarily intended for package authors to make
39 supporting JavaScript/CSS files available to their components.
40
41 Tools for managing static resources published by Shiny's web server:
42 \itemize{
43 \item \code{addResourcePath()} adds a directory of static resources.
44 \item \code{resourcePaths()} lists the currently active resource mappings.
45 \item \code{removeResourcePath()} removes a directory of static resources.
46 }
47 }
48 \examples{
49 addResourcePath('datasets', system.file('data', package='datasets'))
50 resourcePaths()
51 removeResourcePath('datasets')
52 resourcePaths()
53
54 # make sure all resources are removed
55 lapply(names(resourcePaths()), removeResourcePath)
56 }
57 \seealso{
58 \code{\link[=singleton]{singleton()}}
59 }