You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -22,15 +20,50 @@ var serveStatic = require('serve-static')
22
20
23
21
Create a new middleware function to serve files from within a given root
24
22
directory. The file to serve will be determined by combining `req.url`
25
-
with the provided root directory.
23
+
with the provided root directory. When a file is not found, instead of
24
+
sending a 404 response, this module will instead call `next()` to move on
25
+
to the next middleware, allowing for stacking and fall-backs.
26
+
27
+
#### Options
28
+
29
+
##### dotfiles
30
+
31
+
Set how "dotfiles" are treated when encountered. A dotfile is a file
32
+
or directory that begins with a dot ("."). Note this check is done on
33
+
the path itself without checking if the path actually exists on the
34
+
disk. If `root` is specified, only the dotfiles above the root are
35
+
checked (i.e. the root itself can be within a dotfile when when set
36
+
to "deny").
37
+
38
+
The default value is `'ignore'`.
39
+
40
+
-`'allow'` No special treatment for dotfiles.
41
+
-`'deny'` Send a 403 for any request for a dotfile.
42
+
-`'ignore'` Pretend like the dotfile does not exist and call `next()`.
43
+
44
+
##### etag
45
+
46
+
Enable or disable etag generation, defaults to true.
47
+
48
+
##### index
49
+
50
+
By default this module will send "index.html" files in response to a request
51
+
on a directory. To disable this set `false` or to supply a new index pass a
52
+
string or an array in preferred order.
53
+
54
+
##### maxAge
55
+
56
+
Provide a max-age in milliseconds for http caching, defaults to 0. This
57
+
can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme)
58
+
module.
59
+
60
+
##### redirect
61
+
62
+
Redirect to trailing "/" when the pathname is a dir. Defaults to `true`.
26
63
27
-
Options:
64
+
##### setHeaders
28
65
29
-
-`hidden` Allow transfer of hidden files. defaults to `false`
30
-
-`index` Default file name, defaults to `'index.html'`
31
-
-`maxAge` Browser cache maxAge in milliseconds. This can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) module. defaults to `0`
32
-
-`redirect` Redirect to trailing "/" when the pathname is a dir. defaults to `true`
33
-
-`setHeaders` Function to set custom headers on response.
0 commit comments