Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 100% |
Changes | 0 |
1 | import express from 'express'; |
||
2 | import { Bean } from '@/core/decorators/Bean'; |
||
3 | |||
4 | /** |
||
5 | * Creates an ExpressBean and a Router for this class |
||
6 | * @param path {string} |
||
7 | * @decorator |
||
8 | */ |
||
9 | export function RouterBean(path: string) { |
||
10 | 4 | return (target: any, context: any) => { |
|
11 | 4 | Bean(target, context); |
|
12 | 4 | const router = express.Router(); |
|
13 | 4 | Reflect.defineProperty(target.instance, 'routerConfig', { |
|
14 | 19 | get: () => ({ path, router }), |
|
15 | }); |
||
16 | }; |
||
17 | } |
||
18 |