{
  "author": {
    "name": "Joshua Holbrook",
    "email": "josh@nodejitsu.com",
    "url": "http://jesusabdullah.net"
  },
  "name": "ecstatic",
  "description": "A simple static file server middleware that works with both Express and Flatiron",
  "version": "0.4.13",
  "homepage": "https://github.com/jesusabdullah/node-ecstatic",
  "repository": {
    "type": "git",
    "url": "git@github.com:jesusabdullah/node-ecstatic.git"
  },
  "main": "./lib/ecstatic.js",
  "scripts": {
    "test": "tap test/*.js"
  },
  "bin": {
    "ecstatic": "./lib/ecstatic.js"
  },
  "keywords": [
    "static",
    "web",
    "server",
    "files",
    "mime",
    "middleware"
  ],
  "dependencies": {
    "mime": "1.2.x",
    "ent": "0.0.x",
    "optimist": "~0.3.5"
  },
  "devDependencies": {
    "tap": "0.3.x",
    "request": "2.12.x",
    "express": "3.0.x",
    "union": "0.3.x",
    "mkdirp": "0.3.x"
  },
  "readme": "# Ecstatic [![build status](https://secure.travis-ci.org/jesusabdullah/node-ecstatic.png)](http://travis-ci.org/jesusabdullah/node-ecstatic)\n\n![](http://imgur.com/vhub5.png)\n\nA simple static file server middleware. Use it with a raw http server,\nexpress/connect, or flatiron/union!\n\n# Examples:\n\n## express 3.0.x\n\n``` js\nvar http = require('http');\nvar express = require('express');\nvar ecstatic = require('ecstatic');\n\nvar app = express();\napp.use(ecstatic({ root: __dirname + '/public' }));\nhttp.createServer(app).listen(8080);\n\nconsole.log('Listening on :8080');\n```\n\n## union\n\n``` js\nvar union = require('union');\nvar ecstatic = require('ecstatic');\n\nunion.createServer({\n  before: [\n    ecstatic({ root: __dirname + '/public' }),\n  ]\n}).listen(8080);\n\nconsole.log('Listening on :8080');\n```\n\n## stock http server\n\n``` js\nvar http = require('http');\nvar ecstatic = require('ecstatic');\n\nhttp.createServer(\n  ecstatic({ root: __dirname + '/public' })\n).listen(8080);\n\nconsole.log('Listening on :8080');\n```\n### fall through\nTo allow fall through to your custom routes:\n\n```js\necstatic({ root: __dirname + '/public', handleError: false })\n```\n\n# API:\n\n## ecstatic(opts);\n\nPass ecstatic an options hash, and it will return your middleware!\n\n```js\nvar opts = {\n             root          : __dirname + '/public',\n             baseDir       : '/',\n             cache         : 3600,\n             showDir       : false,\n             autoIndex     : false,\n             humanReadable : true,\n             si            : false,\n             defaultExt    : 'html',\n             gzip          : false\n           }\n```\n\nIf `opts` is a string, the string is assigned to the root folder and all other\noptions are set to their defaults.\n\n### `opts.root` \n\n`opts.root` is the directory you want to serve up.\n\n### `opts.baseDir`\n\n`opts.baseDir` is `/` by default, but can be changed to allow your static files\nto be served off a specific route. For example, if `opts.baseDir === \"blog\"`\nand `opts.root = \"./public\"`, requests for `localhost:8080/blog/index.html` will\nresolve to `./public/index.html`.\n\n### `opts.cache`\n\nCustomize cache control with `opts.cache` , if it is a number then it will set max-age in seconds.\nOther wise it will pass through directly to cache-control. Time defaults to 3600 s (ie, 1 hour).\n\n### `opts.showDir`\n\nTurn **on** directory listings with `opts.showDir === true`. Defaults to **false**.\n\n### `opts.autoIndex`\n\nServe `/path/index.html` when `/path/` is requested.\nTurn **off** autoIndexing with `opts.autoIndex === false`. Defaults to **true**.\n\n### `opts.humanReadable`\n\nIf autoIndexing is enabled, add human-readable file sizes. Defaults to **true**.\nAliases are `humanreadable` and `human-readable`.\n\n### `opts.si`\n\nIf autoIndexing and humanReadable are enabled, print file sizes with base 1000 instead\nof base 1024. Name is inferred from cli options for `ls`. Aliased to `index`, the\nequivalent option in Apache.\n\n### `opts.defaultExt`\n\nTurn on default file extensions with `opts.defaultExt`. If `opts.defaultExt` is\ntrue, it will default to `html`. For example if you want a request to `/a-file`\nto resolve to `./public/a-file.html`, set this to `true`. If you want\n`/a-file` to resolve to `./public/a-file.json` instead, set `opts.defaultExt` to\n`json`.\n\n### `opts.gzip`\n\nSet `opts.gzip === true` in order to turn on \"gzip mode,\" wherein ecstatic will\nserve `./public/some-file.js.gz` in place of `./public/some-file.js` when the\ngzipped version exists and ecstatic determines that the behavior is appropriate.\n\n### `opts.handleError`\n\nTurn **off** handleErrors to allow fall-through with `opts.handleError === false`, Defaults to **true**.\n\n## middleware(req, res, next);\n\nThis works more or less as you'd expect.\n\n### ecstatic.showDir(folder);\n\nThis 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.\n\n### `ecstatic` command\n\nto start a standalone static http server,\nrun `npm install -g ecstatic` and then run `ecstatic [dir?] [options] --port PORT`\nall options work as above, passed in [optimist](https://github.com/substack/node-optimist) style.\n`port` defaults to `8000`. If a `dir` or `--root dir` argument is not passed, ecsatic will\nserve the current dir.\n\n# Tests:\n\n    npm test\n\n# License:\n\nMIT.\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/jesusabdullah/node-ecstatic/issues"
  },
  "_id": "ecstatic@0.4.13",
  "_shasum": "9cb6eaffe211b9c84efb3f553cde2c3002717b29",
  "_from": "ecstatic@0.4.x",
  "_resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-0.4.13.tgz"
}
