-
Notifications
You must be signed in to change notification settings - Fork 0
Decorators
Big Mogician edited this page Dec 7, 2018
·
2 revisions
- 定义控制器
@Controller(prefix: string): RouterFactory;
- 参数 prefix
string
业务路由前缀
- 定义可注入服务
interface IInjectableConfigs {
// 注入类型,枚举
type: InjectScope,
// provider令牌
token: InjectToken
}
@Injectable(): ServiceFactory;
@Injectable(configs: Partial<IInjectableConfigs>): ServiceFactory;
- 定义路由
@Index(path: string[]): RouteFactory;
@GET(path: string): RouteFactory;
@POST(path: string): RouteFactory;
@PUT(path: string): RouteFactory;
@DELETE(path: string): RouteFactory;
- 定义参数
interface ParamsOptions {
// 转换函数
transform: (value: any)=> any;
// 使用静态类型安全
useStatic: boolean;
}
// 定义路由params
@FromParams(): ParamsFactory;
@FromParams(options: Partial<ParamsOptions>): ParamsFactory;
// 定义路由body
@FromBody(): ParamsFactory;
@FromBody(options: Partial<ParamsOptions>): ParamsFactory;
still in working...