Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Create nestjs module without dectorator

I have an object describing a nestjs module

const objectAppModule = {
  imports: [],
  exports: [],
  controllers: [
    MyController
  ],
  providers: [
    provide: 'ControllerDependency',
    useValue: MyDependency
  ]
}

I want to pass this to the NestFactory to create my Nest application.

The NestJs way of doing this is to create a class MyAppModule and to add a decorator.

@Module(objectAppModule)
export class ClassAppModule {}

Then pass it to the NestFactory

const app = await NestFactory.create(ClassAppModule);

I want to achieve the same but without using the @Module decorator. The decorator adds some functionality to the class which is missing in my object but I can't quite figure out what is required.

How can I replicate this functionality to do something like this instead?

const app = await NestFactory.create(objectAppModule);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

To flesh out @Jay McDoniel's comment, the following worked;

export class DummyClass { }

const objectAppModule: DynamicModule = {
  module: DummyClass
  imports: [],
  exports: [],
  controllers: [
    MyController
  ],
  providers: [
    provide: 'ControllerDependency',
    useValue: MyDependency
  ]
}

const app = await NestFactory.create(objectAppModule);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!