Socket
Socket
Sign inDemoInstall

ecstatic

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecstatic - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

5

lib/ecstatic.js

@@ -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 @@ }

};

2

package.json

@@ -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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc