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

270
Views
How to manually get an instance of provider outside of Nest.js

I have an Express.js application that I'm migrating to Nest.js, some application modules are using Nest.js, some aren't.

Let's say I have an OrderModule which is a Nest.js module and it has an OrderService in its providers and I would like to use OrderService in a product module that is not a NestJS module. Is it possible to get an instance of OrderService without converting the product module to a NestJS module?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The only way to get access to Nest's DI container from outside the application would be to export the app instance created by NestFactory.create() and then call app.get(OrderService) to retrieve the service.

about 4 years ago · Juan Pablo Isaza Report

0

It's just an example for include 'apn' module (that is not nestjs native)

import { Injectable } from '@nestjs/common';
import { UserGateway } from '../../users/gateways/user.gateway';

@Injectable()
export class NotificationsGateway {
    private user: UserGateway;
    private appleapn = require('apn');
...
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!