MCPcopy
hub / github.com/nestjs/nest / RequestMapping

Function RequestMapping

packages/common/decorators/http/request-mapping.decorator.ts:14–30  ·  view source on GitHub ↗
(
  metadata: RequestMappingMetadata = defaultMetadata,
)

Source from the content-addressed store, hash-verified

12};
13
14export 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
32const createMappingDecorator =
33 (method: RequestMethod) =>

Callers 6

TestRouteClass · 0.90
BaseControllerClass · 0.90
TestRouteClass · 0.90
TestClass · 0.90
createMappingDecoratorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected