1.1.8 • Published 4 years ago

@conorpai/koa-static-router v1.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

koa-static-router

npm.io npm.io

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 }
))