1.4.3 • Published 5 years ago

awesome-static v1.4.3

Weekly downloads
22
License
MIT
Repository
-
Last release
5 years ago

Awesome-Static Build Status npm TypeScript

Koa static file serving middleware base on koa-send.

Feature

Some new features compared to koa-static.

  • :monkey:Set the route map to static file directory
  • :sunny:More than GET and HEAD
  • :coffee: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);
  • root root directory string. nothing above this root directory can be served (Type: string).
  • options options object (Type:AwesomeOptions).

Type AwesomeOptions

Extends options from koa-static

  • route route for mapping to a static server (Type:string).
  • allowMethods HTTP method for allow access static file (Type:HTTPMethod).

Type HTTPMethod

GET | HEAD | POST | PUT | DELETE

License

MIT

1.4.3

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago