@conorpai/koa-static-router
v1.1.8
Published
Serving for koa-send to be a static server
Downloads
9
Maintainers
Readme
koa-static-router
Static file serving middleware with router
Installation
$ npm install koa-static-router
Usage
A Single Router
app.use(static({
dir,
route
}))
Multiple Router
please make sure that routing is same length when you choose Multiple Router (多个路由时,请确保路由长度相同)
'/static/' - >routing length = 1
'/static/image1/' - >routing length =2
app.use(static([
{
dir', //dir:static resource directory
router //router:router
},{
dir,
router
}
]))
const static = require('koa-static-router');
// A Single Router
// app.use(static({
// dir:'public',
// router:'/static/'
// }))
//Multiple Router
app.use(static([
{
dir:'public',
router:'/public/image/' //routing length = 2
},{
dir:'static',
router:'/static/image/' //routing length = 2
}
]))