【文件属性】:
文件名称:路由装饰器:简化Koa和Express路由创建的ES7装饰器
文件大小:6KB
文件格式:ZIP
更新时间:2021-02-03 14:49:18
koa routes decorators es7-decorators KoaJavaScript
Koa / Express的路线装饰器
简化Koa和Express路线创建的。 使用这些装饰器,您可以像下面那样编写控制器,并填充所有路由。
考阿
import { controller , get , post } from 'route-decorators'
@ controller ( '/users' , middleware1 )
class UserCtrl {
@ get ( '/:id' , middleware2 , middleware3 )
async get ( context , next ) { }
@ post ( middleware2 )
async post ( context , next ) { }
}
表达
import { controller , get , post } from 'route-decorators'
@ controller ( '/users' , middleware1 )
class UserCtrl {
@ get ( '/:id' , middleware2 , middleware
【文件预览】:
route-decorators-master
----.travis.yml(89B)
----.babelrc(17B)
----package.json(954B)
----.github()
--------FUNDING.yml(22B)
----test()
--------decorators.spec.js(2KB)
----LICENSE(1KB)
----src()
--------decorators.js(2KB)
----.npmignore(30B)
----.gitignore(17B)
----README.md(3KB)