1.4.3 • Published 7 years ago
awesome-static
Licence
MIT
Version
1.4.3
Deps
3
Size
7 kB
Vulns
0
Weekly
0
Awesome-Static

Koa static file serving middleware base on koa-send.
Feature
Some new features compared to koa-static.
- Set the route map to static file directory
- More than
GETandHEAD - Develop with Typescript
Installation
npm
npm install awesome-static
yarn
yarn add awesome-static
Usage
const Koa = require('koa');
const static = require('awesome-static');
const app = new Koa();
app.use(
static('public', {
allowMethods: ['GET', 'HEAD', 'POST'],
route: 'hello',
}),
);
app.listen(8080);
See /example.
API
AwesomeStatic(root, options);
rootroot directory string. nothing above this root directory can be served (Type:string).optionsoptions object (Type:AwesomeOptions).
[Type] AwesomeOptions
Extends options from koa-static
routeroute for mapping to a static server (Type:string).allowMethodsHTTP method for allow access static file (Type:HTTPMethod).
[Type] HTTPMethod
GET | HEAD | POST | PUT | DELETE
License
MIT