@nestjs/core#MetadataScanner TypeScript Examples
The following examples show how to use
@nestjs/core#MetadataScanner.
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: mqtt.explorer.ts From nest-mqtt with MIT License | 6 votes |
constructor(
private readonly discoveryService: DiscoveryService,
private readonly metadataScanner: MetadataScanner,
@Inject(MQTT_LOGGER_PROVIDER) private readonly logger: Logger,
@Inject(MQTT_CLIENT_INSTANCE) private readonly client: Client,
@Inject(MQTT_OPTION_PROVIDER) private readonly options: MqttModuleOptions,
) {
this.subscribers = [];
}
Example #2
Source File: listener.explorer.spec.ts From nest-amqp with MIT License | 6 votes |
describe('ListenerExplorer', () => {
let service: ListenerExplorer;
let module: TestingModule;
@Injectable()
class TestListener {
@Listen('queue-name')
public listen() {}
public doNothing() {}
}
@Module({ providers: [TestListener] })
class TestModule {}
beforeEach(async () => {
module = await Test.createTestingModule({
imports: [TestModule],
providers: [ListenerExplorer, MetadataScanner],
}).compile();
service = module.get<ListenerExplorer>(ListenerExplorer);
});
afterEach(() => {
module.close();
});
it('should be defined', () => {
expect(service).toBeDefined();
});
it('should explore the modules', () => {
const listenerMethods = service.explore();
expect(listenerMethods).toHaveLength(1);
});
});
Example #3
Source File: listener.explorer.ts From nest-amqp with MIT License | 5 votes |
constructor(private readonly modulesContainer: ModulesContainer, private readonly metadataScanner: MetadataScanner) {}
Example #4
Source File: queue.module.ts From nest-amqp with MIT License | 5 votes |
private static readonly moduleDefinition: DynamicModule = {
global: false,
module: QueueModule,
providers: [AMQPService, QueueService, MetadataScanner, ListenerExplorer, ObjectValidatorService],
exports: [QueueService],
};