Comparing version 0.3.0 to 0.3.1
@@ -108,4 +108,6 @@ var path = require('path'), | ||
if (opts.showDir) { | ||
showDir(opts, stat)(req, res); | ||
return showDir(opts, stat)(req, res); | ||
} | ||
return status[403](res, next); | ||
}); | ||
@@ -200,2 +202,1 @@ } | ||
}; | ||
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"homepage": "https://github.com/jesusabdullah/node-ecstatic", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -11,3 +11,3 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jesusabdullah/node-ecstatic.png)](http://travis-ci.org/jesusabdullah/node-ecstatic) | ||
## express 3.0.x | ||
<a href="https://runnable.com/#jesusabdullah/ecstatic-express/server.js/launch" target="_blank"><img src="https://runnable.com/external/styles/assets/runnablebtn.png" style="width:67px;height:25px;"></a> | ||
``` js | ||
@@ -26,3 +26,3 @@ var http = require('http'); | ||
## union | ||
<a href="https://runnable.com/#jesusabdullah/ecstatic-union/server.js/launch" target="_blank"><img src="https://runnable.com/external/styles/assets/runnablebtn.png" style="width:67px;height:25px;"></a> | ||
``` js | ||
@@ -42,3 +42,3 @@ var union = require('union'); | ||
## stock http server | ||
<a href="https://runnable.com/#jesusabdullah/ecstatic-http/server.js/launch" target="_blank"><img src="https://runnable.com/external/styles/assets/runnablebtn.png" style="width:67px;height:25px;"></a> | ||
``` js | ||
@@ -67,4 +67,20 @@ var http = require('http'); | ||
```js | ||
var opts = { | ||
root : __dirname + '/public', | ||
baseDir : '/', | ||
cache : 3600, | ||
showDir : false, | ||
autoIndex : false, | ||
defaultExt : 'html', | ||
gzip : false | ||
} | ||
``` | ||
### `opts.root` | ||
`opts.root` is the directory you want to serve up. | ||
### `opts.baseDir` | ||
`opts.baseDir` is `/` by default, but can be changed to allow your static files | ||
@@ -75,8 +91,17 @@ to be served off a specific route. For example, if `opts.baseDir === "blog"` | ||
### `opts.cache` | ||
Customize cache control with `opts.cache`, in seconds. Time defaults to 3600 s | ||
(ie, 1 hour). | ||
Turn **on** directory listings with `opts.showDir === true`. Turn **on** | ||
autoIndexing with `opts.autoIndex === true`. Defaults to **false**. | ||
### `opts.showDir` | ||
Turn **on** directory listings with `opts.showDir === true`. | ||
### `opts.autoIndex` | ||
Turn **on** autoIndexing with `opts.autoIndex === true`. Defaults to **false**. | ||
### `opts.defaultExt` | ||
Turn on default file extensions with `opts.defaultExt`. If `opts.defaultExt` is | ||
@@ -88,2 +113,4 @@ true, it will default to `html`. For example if you want a request to `/a-file` | ||
### `opts.gzip` | ||
Set `opts.gzip === true` in order to turn on "gzip mode," wherein ecstatic will | ||
@@ -93,7 +120,7 @@ serve `./public/some-file.js.gz` in place of `./public/some-file.js` when the | ||
### middleware(req, res, next); | ||
## middleware(req, res, next); | ||
This works more or less as you'd expect. | ||
## ecstatic.showDir(folder); | ||
### ecstatic.showDir(folder); | ||
@@ -100,0 +127,0 @@ This returns another middleware which will attempt to show a directory view. Turning on auto-indexing is roughly equivalent to adding this middleware after an ecstatic middleware with autoindexing disabled. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
222050
772
129
5