Closed aventez closed 8 months ago
why not using alternatives like tsyringe? I believe you could build an API similar to NestJS on top of it
AFIAK Nest's DI container isn't something that was designed to live outside of nestjs, and so changing it to support v8 only would be hard.
AFIAK Nest's DI container isn't something that was designed to live outside of nestjs, and so changing it to support v8 only would be hard.
Probably it was - https://docs.nestjs.com/standalone-applications
why not using alternatives like tsyringe? I believe you could build an API similar to NestJS on top of it
We use Inversify and that's the only option, but having all the rest NestJS features just can be great
still, it's a nodejs framework
asking to support v8 only or anything not related with nodejs seems out of the scope of the fw to me
@aventez, try the DI used in Ditsmod. It can work completely independent of Ditsmod. It is built on the basis of the Angular v4.4.7 native module.
import { Injector, injectable } from '@ditsmod/core';
class Service1 {}
@injectable()
class Service2 {
constructor(service1: Service1) {}
}
@injectable()
class Service3 {
constructor(service2: Service2) {}
}
const injector = Injector.resolveAndCreate([Service1, Service2, Service3]);
const service3 = injector.get(Service3);
service3 === injector.get(Service3); // true
service3 === injector.resolveAndInstantiate(Service3); // false
Thanks for your suggestion!
There are no plans to implement it in the foreseeable future.
If you think your request could live outside Nest's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
My team and I are working on game software for GTA V multiplayer, where the gamemode (client+server) is written based on TS. We had the idea of using some of the Nest.js functionality on the client and server for DI IoC and good architecture.
The game API provides us with the V8 runtime for clientside and Node.js for serverside soft. Unfortunately, we are not able to run DI with Nest.js having only V8 at our disposal, as core Nest.js is strongly tied to the Node API (especially HTTPs). Nest could solve many problems.
Describe the solution you'd like
It can be great to decouple Nest.js core from Node.js API to make it possible to use with V8 runtime apps.
What is the motivation / use case for changing the behavior?
Many other applications could use Nest as an IoC/DI wrapper, making the framework even more elastic and not limited to backend solutions.