The example in the Readme should work
I nearly exactly copied the example from the readme, but always got a error.
Update Readme
Tried to setup a small project for testing. For me it helped to take a look into the tests and change my kernel config like there:
let kernel = new Kernel();
kernel.bind<AboutController>('AboutController').to(AboutController);
When it is used like the readme says
Error: No bindings found for serviceIdentifier: AboutController
at Kernel._getActiveBindings (path to project/inversify/lib/kernel/kernel.js:169:23)
at Kernel._plan (path to project/inversify/lib/kernel/kernel.js:186:29)
at Kernel._planAndResolve (path to project/inversify/lib/kernel/kernel.js:157:29)
at Kernel._get (path to project/inversify/lib/kernel/kernel.js:149:27)
at Kernel.get (path to project/inversify/lib/kernel/kernel.js:80:21)
at handler (path to project/inversify-express-utils/lib/route-container.js:37:39)
at Layer.handle [as handle_request] (path to project/express/lib/router/layer.js:95:5)
at next (path to project/express/lib/router/route.js:131:13)
at Route.dispatch (path to project/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (path to project/express/lib/router/layer.js:95:5)
This example has not been updated for some time :( My main goal right now is to finish the 2.0.0 release. I will then focus on all the side projects and the examples. You can try to help with this but I would recommend you to wait until https://github.com/inversify/InversifyJS/issues/256 is completed to avoid re-doing work.
Okay, will take a look at the issues later today and look if I fined something.
Currently working on a example for express. Possible that a PR for it comes today :)
Great :+1: My plan is to release [email protected] and [email protected] before Monday.
What is there todo in inversify-express-utils? Updating the inversify dependencies?
I just finished it https://github.com/inversify/inversify-express-utils/pull/4 I also need to update https://github.com/inversify/inversify-dts and release both. I just created https://github.com/inversify/inversify-express-example maybe you can start by moving the code to that repo?
As soon as I am ready with it I will make a PR
Hey guys, thanks a lot for the contributions and help!
I took a look at https://github.com/inversify/inversify-express-example and it looks good. The only problem is that after @remojansen makes the 1.0.0-beta.1 release, the way the controllers are bound to the kernel will need to change slightly, see https://github.com/inversify/inversify-express-utils/pull/3.
Otherwise it is good. In the future it would be nice to add examples for using middleware (maybe passport?) and a vanilla JavaScript example.
Thanks.
In the next few days I will create more examples. This was the most basic one I could think of.
This issue can now be closed right? If you want more examples we can create new issues for each example?
I think yes. With the updated Readme it works
Most helpful comment
Hey guys, thanks a lot for the contributions and help!
I took a look at https://github.com/inversify/inversify-express-example and it looks good. The only problem is that after @remojansen makes the 1.0.0-beta.1 release, the way the controllers are bound to the kernel will need to change slightly, see https://github.com/inversify/inversify-express-utils/pull/3.
Otherwise it is good. In the future it would be nice to add examples for using middleware (maybe passport?) and a vanilla JavaScript example.