nyc-bookstores/node_modules/ecstatic/package.json

51 lines
5.6 KiB
JSON
Raw Normal View History

2013-05-27 20:45:59 +00:00
{
"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.2",
"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.7",
"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<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>\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<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>\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<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>\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 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 === true`. Defaults to **true**.\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## 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 mi
"readmeFilename": "README.md",
"_id": "ecstatic@0.4.2",
"dist": {
"shasum": "60531cb6145251482932e45cb68b47804c895a6a"
},
"_from": "ecstatic@",
"_resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-0.4.2.tgz"
}