Questions tagged [inversifyjs]

InversifyJS is a lightweight IoC container written in TypeScript.

InversifyJS is a lightweight pico inversion of control (IoC) container for TypeScript and JavaScript apps. A pico IoC container uses a class constructor to identify and inject its dependencies.

InversifyJS is easy to integrate with the majority of existing JavaScript frameworks and encourage the usage of the best OOP and IoC practices.

You can learn more about InversifyJS at http://inversify.io/

156 questions
2
votes
2 answers

How to achieve component scanning/auto discovery of Controllers using Inversify + inversify-express-utils

I am looking for a way to load my controller classes in Inversify that are annotated with @controller() from inversify-express-utils without needing to manage a hand crafted/manually constructed module of imports/exports. All of the examples I am…
Vigs
  • 1,086
  • 3
  • 11
  • 29
2
votes
0 answers

Getting 204 response before db action callback in expressjs, mongodb, inversifyjs

I want to add new document to the mongodb and get an inserted id as response with 201 status, but when db.insertOne called I get response with 204 status code before tap works. Here is my controller @controller('/stars') export class StarController…
Lilit
  • 21
  • 1
2
votes
1 answer

Missing @inject annotation, which isn't missing in inversify with an extending class

I'm having a problem which seems a bit hard to put into a title, which is why you've gotten this beast of a title. I get an error stating: Error: Missing required @inject or @multiInject annotation in: argument 0 in class SceneRepository.. This…
Pjetr
  • 1,335
  • 9
  • 19
2
votes
1 answer

inversify: not injectable contrustor arguments

I have a Game class and a Multiplayer class which handle all network players stuff for defined game: export interface Multiplayer{ game: Game start() } export class WebSocketMultiplayer implements Multiplayer{ constructor(public game:…
SET
  • 10,274
  • 4
  • 42
  • 70
2
votes
1 answer

IoC in React without typescript

I'm pretty new to React, and I would essentially have a service (one single instance) that I could somehow inject and use in multiple React components. So far, the options I've come across by googling were: Using React's context, but it's not…
Fabio Salvalai
  • 2,382
  • 15
  • 29
2
votes
2 answers

InversifyJS - Inject middleware into controller

I'm using inversify-express-utils using the shortcut decorators (@GET, @POST...) within a node application. Is it possible to inject middleware into the controller to use with these decorators? Example of what I'm trying to achieve (doesn't…
carlcheel
  • 581
  • 5
  • 11
2
votes
1 answer

How can I inject knex using inversify?

How can I initialise knex and use Inversify dependency injector to inject it in every where that i needed?
user4092086
  • 446
  • 1
  • 8
  • 22
2
votes
1 answer

Binding classes with property injection to kernel in inversify

I am trying to achieve dependency injection on my node project via inversify. I have a kernel config like this: inversify.config.ts import "reflect-metadata"; import {Kernel, interfaces} from "inversify"; import {Config} from "./config"; import…
Umut Benzer
  • 3,295
  • 2
  • 31
  • 53
1
vote
1 answer

Clear inversify-js container and resolve new service instances

I have a react-native application frontend using inversify-js. I've structured some service classes to use IOC (using an inversify container), such services intended to be shared as just one singleton instances among other services. They have an…
1
vote
1 answer

Error during initialization: No matching bindings found for serviceIdentifier: Symbol(LicencesService)

I am getting error while compiling the code : No matching bindings found for serviceIdentifier: Symbol(LicencesService) Following is the code associated with the issue. The issue is with the constructor of the HTTP on server.ts file, how do I…
1
vote
0 answers

Inject and injectable in ts

I don't know much of OOPS pattern. I have previously worked in react and never came to a point where Dependency injection and inversion are required (or anyone using it). I was going through Theia Ide extension docs and was having tough time…
1
vote
0 answers

Can't get property dependency injection to work in React project

I need some really basic dependency injection for a react project in a similar syntactical manner as in C# or Java. Using context or injection through props is not an option. I tried three solutions so…
Beltway
  • 136
  • 11
1
vote
0 answers

class circular dependency resolve with inversifyJS

I have tried to understand how to resolve circular dependencies using InversifyJS but I'm still having an issue. I have a class Leader which needs to have a Follower and the Follower instance must be bound to Leader. I'm using lazyInject from…
killerchip
  • 77
  • 1
  • 1
  • 7
1
vote
0 answers

InversifyJS purpose of using .toConstantValue

We already have inSingletonScope in Insersify JS. What is the purpose of using .toConstantValue? Could anyone let me know when do we want to use .toConstantValue?
1
vote
1 answer

Unable to catch errors globally from inversify-express-utils controllers

I'm using this package https://github.com/inversify/inversify-express-utils for a nodejs app, and I want to have a place to handle errors from any controller, the way I know is to use express error handler, but it doesn't seems to work in this case-…
Avishay28
  • 1,664
  • 2
  • 17
  • 34
1 2
3
10 11