1.0.4 • Published 8 years ago

koa-router-prefix v1.0.4

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

Koa Router Prefix

根据文件名自动生成路由前缀

Installation

$ npm i koa-router-auto --save

Example

const app = new Koa()
const path = require('path')
const routerPrefix = require('koa-router-prefix')

routerPrefix(app, {
  dir: path.join(__dirname, './controller'),
})

// controller/user.js
module.exports = function userRouter(route) {
  route.get('/name', function* () {
    this.body = 'user name'
  })
}

// $ curl locahost:8080/user/name
// user name
1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago