【文件属性】:
文件名称:ts-koa-router-decorator:使用TypeScript的装饰器配合Koa2和koa-router实现Spring启动注解
文件大小:86KB
文件格式:ZIP
更新时间:2021-02-03 17:34:58
koa typescript spring-boot decorator koa-router
打字稿装饰器实现koa路由(工程模板)
使用TypeScript的装饰器实现Spring boot注解以方便的编写路由如在使用过程中碰到问题可提交issues通过电子邮件: 1450941858@qq.com
原理
首先需要知道ts装饰器的执行顺序
然后一步一步的对相关的装饰器进行反射
然后动态加载模块
解析相关的模块
将模块中的方法进行解析
将解析的方法打包成一个路由函数
将函数加载到koa-router
实现的'注解'
名称
用法
说明
参数必要
控制者
@Controller('\ user')
用于类的注解
是
得到
@GET(':id')
创建一个GET方式的路由。用于方法的注解
是
【文件预览】:
ts-koa-router-decorator-master
----package.json(1KB)
----yarn-error.log(3KB)
----package-lock.json(76KB)
----dist()
--------index.js(40B)
----src()
--------core()
--------controller()
--------utils()
--------index.ts(777B)
----.eslintrc.js(693B)
----tsconfig.json(6KB)
----.gitignore(13B)
----README.md(2KB)
----yarn.lock(140KB)
----nodemon.json(246B)