question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It can be nice to have access of the NestContainer instance of the application on the modules

See original GitHub issue

With application container access, you can build modules that have annotations…

I am building a NestJS module that works with Kue, so in the application controllers I can have something like this to define a Task:

@Task({ name: 'justOneTest' })
justOneTest(done, task) {
    console.log('Received task:', task);
    setTimeout(done, 5000);
}

Then create a new job with:

kueService.create(this.justOneTest);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
erickponcecommented, May 15, 2018

I have shared the code on https://github.com/erickponce/nestjs-kue feel free to use it.

Note that this is not tested on production environments, and there are improvements to be made =)

1reaction
erickponcecommented, Nov 7, 2017

I changed the implementation to use ModuleRef accordingly to CQRS module and it works perfectly.

Thank you @kamilmysliwiec 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom providers | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines ...
Read more >
What is the NestJS Runtime - Trilon Consulting
In case you're not familiar with NestJS, it is a TypeScript Node.js framework that helps you build enterprise-grade efficient and scalable Node.
Read more >
Application context - NestJS - Netlify
Nest context is a wrapper around the Nest container, which holds all instantiated classes. We can grab an existing instance from within any...
Read more >
Containerized development with NestJS and Docker
With a single command, nest new app-name , we have a fully functional, ready-to-go application. The generated setup is fine for a simple ......
Read more >
Nestjs
Depending on which underlying platform we use, we will get access to its ... instance of any provider between multiple modules effortlessly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found