@nestjs/core#ModulesContainer TypeScript Examples

The following examples show how to use @nestjs/core#ModulesContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: debug.module.ts    From emutypekov with GNU General Public License v3.0 6 votes vote down vote up
static graph(app: INestApplication): void {
    /**
     * Build the tree:
     * 1. Find the AppModule
     * 2. Recursively browse its imports and
     * 3. Ignore core modules attached to each module like "InternalCoreModule" and "ConfigHostModule"
     */
    const container = app.get(ModulesContainer);
    const moduleWrappers = Array.from(container.values());
    const appModule = moduleWrappers.find(
      (moduleWrapper) => moduleWrapper.metatype.name === 'CoreModule',
    );
    const tree = getTree(appModule);

    // Add the routes
    const basePath = '/dependency-graph';
    const adapter = app.getHttpAdapter();
    adapter.get(`${basePath}/data`, (req: Request, res: Response) => {
      return res.json(tree);
    });
    adapter.get(`${basePath}/index.html`, (req: Request, res: Response) => {
      res.sendFile(join(__dirname, 'static', 'index.html'));
    });
    adapter.get(`${basePath}/main.js`, (req: Request, res: Response) => {
      res.sendFile(join(__dirname, 'static', 'main.js'));
    });
  }
Example #2
Source File: prepare-options.service.ts    From typegraphql-nestjs with MIT License 5 votes vote down vote up
constructor(
    private readonly moduleRef: ModuleRef,
    private readonly modulesContainer: ModulesContainer,
  ) {}
Example #3
Source File: discovery-factory-service.ts    From pebula-node with MIT License 5 votes vote down vote up
constructor(private readonly modulesContainer: ModulesContainer) { }
Example #4
Source File: discovery-service.ts    From pebula-node with MIT License 5 votes vote down vote up
constructor(private readonly modulesContainer: ModulesContainer,
              private readonly explorer: SbDiscoveryMetadataExplorer,
              serverOptions: SbServerOptions[],
              clientOptions: SbClientOptions[],
              metadataHelper?: any,) {
    this.server = new SbServerDiscoveryService(serverOptions, metadataHelper);
    this.client = new SbClientDiscoveryService(clientOptions, metadataHelper);
  }
Example #5
Source File: listener.explorer.ts    From nest-amqp with MIT License 5 votes vote down vote up
constructor(private readonly modulesContainer: ModulesContainer, private readonly metadataScanner: MetadataScanner) {}