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

Class RoutesResolver

packages/core/router/routes-resolver.ts:35–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33import { RouterProxy } from './router-proxy';
34
35export class RoutesResolver implements Resolver {
36 private readonly logger = new Logger(RoutesResolver.name, {
37 timestamp: true,
38 });
39 private readonly routerProxy = new RouterProxy();
40 private readonly routePathFactory: RoutePathFactory;
41 private readonly routerExceptionsFilter: RouterExceptionFilters;
42 private readonly routerExplorer: RouterExplorer;
43
44 constructor(
45 private readonly container: NestContainer,
46 private readonly applicationConfig: ApplicationConfig,
47 private readonly injector: Injector,
48 graphInspector: GraphInspector,
49 ) {
50 const httpAdapterRef = container.getHttpAdapterRef();
51 this.routerExceptionsFilter = new RouterExceptionFilters(
52 container,
53 applicationConfig,
54 httpAdapterRef,
55 );
56 this.routePathFactory = new RoutePathFactory(this.applicationConfig);
57
58 const metadataScanner = new MetadataScanner();
59 this.routerExplorer = new RouterExplorer(
60 metadataScanner,
61 this.container,
62 this.injector,
63 this.routerProxy,
64 this.routerExceptionsFilter,
65 this.applicationConfig,
66 this.routePathFactory,
67 graphInspector,
68 );
69 }
70
71 public resolve<T extends HttpServer>(
72 applicationRef: T,
73 globalPrefix: string,
74 ) {
75 const modules = this.container.getModules();
76 modules.forEach(({ controllers, metatype }, moduleName) => {
77 const modulePath = this.getModulePathMetadata(metatype)!;
78 this.registerRouters(
79 controllers,
80 moduleName,
81 globalPrefix,
82 modulePath,
83 applicationRef,
84 );
85 });
86 }
87
88 public registerRouters(
89 routes: Map<string | symbol | Function, InstanceWrapper<Controller>>,
90 moduleName: string,
91 globalPrefix: string,
92 modulePath: string,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected