Comparing version 0.3.2 to 0.4.0
@@ -5,27 +5,36 @@ // This is so you can have options aliasing and defaults in one place. | ||
var autoIndex = !opts | ||
|| [ | ||
var autoIndex = true, | ||
showDir = false, | ||
defaultExt; | ||
if (opts) { | ||
[ | ||
'autoIndex', | ||
'autoindex' | ||
].some(function (k) { | ||
return opts[k]; | ||
if (typeof opts[k] !== undefined && opts[k] !== null) { | ||
autoIndex = opts[k]; | ||
return true; | ||
} | ||
}); | ||
var showDir = !opts | ||
|| [ | ||
[ | ||
'showDir', | ||
'showdir' | ||
].some(function (k) { | ||
return opts[k]; | ||
if (typeof opts[k] !== undefined && opts[k] !== null) { | ||
showDir = opts[k]; | ||
return true; | ||
} | ||
}); | ||
var defaultExt; | ||
if (opts && opts.defaultExt) { | ||
if (opts.defaultExt === true) { | ||
defaultExt = 'html'; | ||
if (opts.defaultExt) { | ||
if (opts.defaultExt === true) { | ||
defaultExt = 'html'; | ||
} | ||
else { | ||
defaultExt = opts.defaultExt; | ||
} | ||
} | ||
else { | ||
defaultExt = opts.defaultExt; | ||
} | ||
} | ||
@@ -32,0 +41,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/jesusabdullah/node-ecstatic", | ||
@@ -25,5 +25,2 @@ "repository": { | ||
], | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"dependencies": { | ||
@@ -30,0 +27,0 @@ "mime": "1.2.7", |
@@ -76,2 +76,5 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jesusabdullah/node-ecstatic.png)](http://travis-ci.org/jesusabdullah/node-ecstatic) | ||
If `opts` is a string, the string is assigned to the root folder and all other | ||
options are set to their defaults. | ||
### `opts.root` | ||
@@ -95,7 +98,8 @@ | ||
Turn **on** directory listings with `opts.showDir === true`. | ||
Turn **on** directory listings with `opts.showDir === true`. Defaults to **false**. | ||
### `opts.autoIndex` | ||
Turn **on** autoIndexing with `opts.autoIndex === true`. Defaults to **false**. | ||
Serve `/path/index.html` when `/path/` is requested. | ||
Turn **off** autoIndexing with `opts.autoIndex === true`. Defaults to **true**. | ||
@@ -102,0 +106,0 @@ ### `opts.defaultExt` |
223361
797
141