# @conorpai/koa-static-router

> Serving for koa-send to be a static server

Latest version **1.1.8** (published 2020-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @conorpai/koa-static-router
pnpm add @conorpai/koa-static-router
yarn add @conorpai/koa-static-router
bun add @conorpai/koa-static-router
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.8 |
| Published | 2020-04-29 |
| First published | 2020-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 7.6.0 |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | baiguangnan@163.com |
| Maintainers | conorpai |
| Keywords | koa, file, static, sendfile, router |

## Links

- npm: https://www.npmjs.com/package/@conorpai/koa-static-router
- Repository: https://github.com/ConorPai/koa-static-router
- Homepage: https://github.com/ConorPai/koa-static-router#readme
- Issues: https://github.com/ConorPai/koa-static-router/issues
- npm.io page: https://npm.io/package/@conorpai/koa-static-router

## Dependencies (1)

- [koa-send](https://npm.io/package/koa-send.md) ^5.0.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.1.8 (latest) — 2020-04-29
- 1.1.7 — 2020-04-29

## README

# koa-static-router
![](https://img.shields.io/badge/npm-1.1.3-blue.svg)
![](https://img.shields.io/badge/license-MIT-brightgreen.svg)


Static file serving middleware with router

## Installation

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

---
_Source: https://npm.io/package/@conorpai/koa-static-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
