buffet
v1.0.11
Published
Static file server with in-memory cache
Downloads
380
Maintainers
Readme
buffet
Static file server with in-memory cache
Usage
Middleware
Middleware version (compatible with connect, union/flatiron, middler, etc.)
var connect = require('connect')
, app = connect()
, buffet = require('buffet')({root: './public'}) // root defaults to ./public
app.use(buffet);
// (non-static routes here)
app.use(buffet.notFound);
var server = require('http').createServer(app);
server.listen(3000, function () {
console.log('test server running on port 3000');
});
Easy built-in server
$ npm install -g buffet
$ cd /var/www/html && buffet
As a request handler
var server = require('http').createServer();
var buffet = require('buffet')(); // root defaults to ./public
server.on('request', buffet);
server.listen(3000, function () {
console.log('test server running on port 3000');
});
Options
root
: Document root. Can also be passed as the first parameter tobuffet()
. (Default:./public
)indexes
: True to look foroptions.index
and serve it for directory requests. (Default: true)index
: Name of index file to look for. (Default:index.html
)watch
: True to auto-update the buffer when files change. (Default:true
)notFoundPath
: Path to be rendered onbuffetMiddleware.notFound
. (Default:/404.html
)defaultContentType
: If the file does not have an extension, set this to specify the defaultContent-Type
sent to the browser. This defaults toapplication/octet-stream
.
Running your own benchmark
Type make bench
in the buffet directory (you'll need
siege installed).
Brought to you by benchmarx.
See here for my results.
Developed by Terra Eclipse
Terra Eclipse, Inc. is a nationally recognized political technology and strategy firm located in Aptos, CA and Washington, D.C.
License: MIT
- Copyright (C) 2014 Carlos Rodriguez (http://s8f.org/)
- Copyright (C) 2014 Terra Eclipse, Inc. (http://www.terraeclipse.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.