( metadata: RequestMappingMetadata = defaultMetadata, )
| 12 | }; |
| 13 | |
| 14 | export const RequestMapping = ( |
| 15 | metadata: RequestMappingMetadata = defaultMetadata, |
| 16 | ): MethodDecorator => { |
| 17 | const pathMetadata = metadata[PATH_METADATA]; |
| 18 | const path = pathMetadata && pathMetadata.length ? pathMetadata : '/'; |
| 19 | const requestMethod = metadata[METHOD_METADATA] || RequestMethod.GET; |
| 20 | |
| 21 | return ( |
| 22 | target: object, |
| 23 | key: string | symbol, |
| 24 | descriptor: TypedPropertyDescriptor<any>, |
| 25 | ) => { |
| 26 | Reflect.defineMetadata(PATH_METADATA, path, descriptor.value); |
| 27 | Reflect.defineMetadata(METHOD_METADATA, requestMethod, descriptor.value); |
| 28 | return descriptor; |
| 29 | }; |
| 30 | }; |
| 31 | |
| 32 | const createMappingDecorator = |
| 33 | (method: RequestMethod) => |
no outgoing calls
no test coverage detected