@@ -154,7 +154,7 @@ of an error.
154
154
155
155
### Options when creating an instance of ` Server `
156
156
157
- #### ` cache `
157
+ #### ` cache ` (Default: ` 3600 ` )
158
158
159
159
Sets the ` Cache-Control ` header.
160
160
@@ -166,26 +166,19 @@ Passing `false` will disable the `Cache-Control` header.
166
166
Passing a object with [ minimatch glob pattern] ( https://github.com/isaacs/minimatch )
167
167
keys and number values will set cache max-age for any matching paths.
168
168
169
- > Defaults to ` 3600 `
170
-
171
-
172
- #### ` serverInfo `
169
+ #### ` serverInfo ` (Default: ` node-static/{version} ` )
173
170
174
171
Sets the ` Server ` header.
175
172
176
173
example: ` { serverInfo: "myserver" } `
177
174
178
- > Defaults to ` node-static/{version} `
179
-
180
- #### ` headers `
175
+ #### ` headers ` (Default: ` {} ` )
181
176
182
177
Sets response headers.
183
178
184
179
example: ` { headers: { 'X-Hello': 'World!' } } `
185
180
186
- > defaults to ` {} `
187
-
188
- #### ` gzip `
181
+ #### ` gzip ` (Default: ` false ` )
189
182
190
183
Enable support for sending compressed responses. This will enable a check for
191
184
a file with the same name plus '.gz' in the same folder. If the compressed
@@ -201,35 +194,36 @@ Passing `true` will enable this check for all files.
201
194
Passing a RegExp instance will only enable this check if the content-type of
202
195
the respond would match that RegExp using its test() method.
203
196
204
- > Defaults to ` false `
205
-
206
- #### ` indexFile `
197
+ #### ` indexFile ` (Default: ` index.html ` )
207
198
208
199
Choose a custom index file when serving up directories.
209
200
210
201
example: ` { indexFile: "index.htm" } `
211
202
212
- > Defaults to ` index.html `
213
-
214
- #### ` defaultExtension `
203
+ #### ` defaultExtension ` (Default: ` null ` )
215
204
216
205
Choose a default extension when serving files.
217
206
A request to '/myFile' would check for a ` myFile ` folder (first) then a
218
207
` myFile.html ` (second).
219
208
220
209
example: ` { defaultExtension: "html" } `
221
210
222
- > Defaults to ` null `
223
-
224
-
225
211
## Command Line Interface
226
212
227
213
` node-static ` also provides a CLI.
228
214
229
- ### Installation
230
-
231
- ``` sh
232
- $ npm install -g node-static
215
+ ``` text
216
+ --port, -p TCP port at which the files will be served [default: 8080]
217
+ --host-address, -a the local network interface at which to listen [default: "127.0.0.1"]
218
+ --cache, -c "Cache-Control" header setting, defaults to 3600
219
+ --version, -v node-static version
220
+ --headers, -H additional headers (in JSON format)
221
+ --header-file, -f JSON file of additional headers
222
+ --gzip, -z enable compression (tries to serve file of same name plus '.gz')
223
+ --spa Serve the content as a single page app by redirecting all
224
+ non-file requests to the index HTML file.
225
+ --indexFile, -i Specify a custom index file when serving up directories. [default: "index.html"]
226
+ --help, -h display this help message
233
227
```
234
228
235
229
### Example Usage
0 commit comments