Questions tagged [nest-dynamic-modules]
12 questions
6
votes
2 answers
Nest js convert module from forRoot to forRootAsync
@Module({
imports: [],
providers: [SupertokensService, AuthService],
exports: [],
controllers: [AuthController],
})
export class AuthModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
…

Eivydas Vickus
- 109
- 3
- 11
3
votes
0 answers
Create array of providers from Dynamic Module options
I am working with NestJS and I am building re-usable modules, configurable via forRoot and forRootAsync static methods.
I am looking for a way to provide multiple providers of the same class, based on the module options.
export type MyModuleOptions…

tkjwa
- 31
- 2
2
votes
1 answer
Nestjs can't create dynamic module with config import
I am trying to create a DynamicModule in Nestjs, but it seems I can't properly use useFactory to inject ConfigModule in the process.
If I use a hardcoded boolean instead of config.get('cache').enabled everything works as expected, but I receive the…

Killua
- 59
- 5
2
votes
1 answer
NestJs -Pass in path to route handler via Dynamic Module
Im working on a team that has a bunch of services so we have a npm package that contains code shared between the services.
We have a Health check module that sets the path to globalPrefix/health. Im attempting to make this value configurable in a…

Johan van der Veen
- 79
- 1
- 3
- 9
1
vote
1 answer
Cannot inject custom provider for dynamic module
I tried to create a dynamic module PermissionModule like the following:
permTestApp.module.ts
@Module({
imports: [PermissionModule.forRoot({ text: 'abc' })],
providers: [],
controllers: [PermissionTestController],
})
export class…

redism
- 500
- 7
- 18
1
vote
1 answer
Why can't NestJS resolve the dynamic module options parameter I added as a provider?
I made a dynamic module named AuthModule copied from Nest's documentation. I changed it so I could supply different Auth0 tenant credentials to the Auth0Service for every module that imports it. The configuration parameter in the provider array of…

Joachim Rives
- 471
- 6
- 19
1
vote
1 answer
Import a module which has a dynamic module as dependency in nest.js
I'm newbie in nest.js and i'm trying to use a service from Q module in APP module.
Q module is importing a dynamic BullModule for Queue ...
q.module.ts
import { BullModule } from '@nestjs/bull';
import { Module } from '@nestjs/common';
import { join…

Vahid Alimohamadi
- 4,900
- 2
- 22
- 37
0
votes
0 answers
nestjs: Dynamic module for dynamically insert controllers y routes module
im trying to build a dynamic module for dynamically insert additional endpoints to certain routes modules (adding a generic crud endpoints):
crud.module.ts
@Module({})
export class CrudModule {
static register(config): DynamicModule {
const…

adrihfly
- 41
- 4
0
votes
0 answers
NestJs Dynamic Module Inside Service (Runtime)
I am looking at how I can import modules in NestJs runtime based on some logic in the service.
What I am trying to achieve is to build a "plugin" system which uses whichever modules are installed to extend a base service for example, if I have an…

Andy
- 59
- 2
- 11
0
votes
0 answers
nestjs use service from external module inside a dynamic module
AppModule
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
envFilePath: !!ENV ? `.env.${ENV}` : '.env',
}),
AedesModule.forRootAsync({
useFactory: (configService: ConfigService) => ({
port: 1883,
…

Vahid Alimohamadi
- 4,900
- 2
- 22
- 37
0
votes
1 answer
NestJS module import not working in the forRootAsync and forRootMethod of a dynamic module
When trying to import another module inside of my dynamic modules nest throws the following error when using a service exported by that module inside of my services:
Error: Nest can't resolve dependencies of the ActivationService (UsersService, ?,…

dennis-neuhaus
- 1
- 1
0
votes
1 answer
NestJS - how to call Service method in Module options
I'm trying out a event sourced NestJS application.
I'm stuck at the following point:
In my GamesModule I'm setting up the Eventstore connection to my stream.
In these options there are write and read functions which are called by the library to…

petervd81
- 21
- 1
- 4