Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@conorpai/koa-static-router

ConorPai159MIT1.1.8

Serving for koa-send to be a static server

koa, file, static, sendfile, router

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