https://github.com/zephyrpersonal/koa-router-decorator
configure koa-app router with ES7 proposal decorator
https://github.com/zephyrpersonal/koa-router-decorator
Last synced: 2 months ago
JSON representation
configure koa-app router with ES7 proposal decorator
- Host: GitHub
- URL: https://github.com/zephyrpersonal/koa-router-decorator
- Owner: zephyrpersonal
- Created: 2017-05-21T06:31:08.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-21T15:18:53.000Z (about 9 years ago)
- Last Synced: 2025-12-12T20:56:25.673Z (7 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# INSTALL
```bash
npm i koa-routermap-decorator -S
```
For decorator is still in ES7 proposal.
So you should use this package with compilers such as Babel
# USAGE
```js
// ES6 module
import {router,Route,RouteMethods} from 'koa-routermap-decorator'
// CommonJS
const {router,Route,RouteMethods} = require('koa-routermap-decorator')
// setup router on app's initialization
await router(app,options)
// you may map controller to route like this
class User {
@Router('/user',RouteMethods.GET)
async getUser(ctx){
ctx.body = {name:'zephyr'}
}
}
```