5.0.0 • Published 7 years ago
koa-static v5.0.0
koa-static
Static file serving middleware.
Installation
$ npm install koa-staticAPI
var koa = require('koa');
var app = koa();
app.use(require('koa-static')(root, opts));- rootroot directory string. nothing above this root directory can be served
- optsoptions object.
Options
- maxageBrowser cache max-age in milliseconds. defaults to 0
- hiddenAllow transfer of hidden files. defaults to false
- indexDefault file name, defaults to 'index.html'
- deferIf true, serves after- yield next, allowing any downstream middleware to respond first.
Example
var serve = require('koa-static');
var koa = require('koa');
var app = koa();
// $ GET /package.json
app.use(serve('.'));
// $ GET /hello.txt
app.use(serve('test/fixtures'));
// or use absolute paths
app.use(serve(__dirname + '/test/fixtures'));
app.listen(3000);
console.log('listening on port 3000');License
MIT
1.5.3
7 years ago
5.0.0
7 years ago
4.0.3
7 years ago
4.0.2
8 years ago
4.0.1
8 years ago
4.0.0
8 years ago
2.1.0
9 years ago
3.0.0
10 years ago
2.0.0
10 years ago
1.5.2
10 years ago
1.5.1
10 years ago
1.5.0
10 years ago
1.4.9
11 years ago
1.4.8
11 years ago
1.4.7
11 years ago
1.4.6
11 years ago
1.4.5
11 years ago
1.4.4
12 years ago
1.4.3
12 years ago
1.4.2
12 years ago
1.4.1
12 years ago
1.4.0
12 years ago
1.3.0
12 years ago
1.2.0
12 years ago
1.1.1
12 years ago
1.1.0
12 years ago
1.0.0
12 years ago