0.1.6 • Published 8 years ago

koa-static-combo v0.1.6

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

koa-static-combo

A static files combo server for Koa.

Installation

npm i koa-static-combo

Usage

const app = require('koa')();
const opts = {
  assetsPath: 'path/to/static/server/root',
  routerReg: /^(\/co)(;.+)?(\?\?)(.+)/i,
  comboTag: '??',
  comboDirTag: ';',
  comboModSplit: ',',
  maxAge: 60 * 60 * 24 * 365 * 1000
};
app.use(combo(opts)).listen(5000);

API

  • assetsPath (str) - the directory you wish to serve.
  • comboDirTag (str) - the url prefix you wish to add, default to ;.
  • comboModSplit (str) - the combo file tag you wish to split, default to ,.
  • maxAge (int) - cache control max age for the files, 365days by default.
  • routerReg (Regex) - the regular expression URL of judgment, must be matched with comboTag.

Example

http://127.0.0.1:5000/co??v/l/vue.js,v/l/zepto.js
<!-- or  -->
http://127.0.0.1:5000/co;v??l/vue.js,l/zepto.js
<!-- or -->
http://127.0.0.1:5000/co;v/l??vue.js,zepto.js
0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago