jeffijoe / awilix-express

Awilix helpers/middleware for Express
MIT License
114 stars 7 forks source link

Integrate with awilix-router-core #5

Closed jeffijoe closed 6 years ago

jeffijoe commented 6 years ago

Hey @talyssonoc — I've been working on a routing abstraction to make routing + dependency resolution super streamlined. The core package is awilix-router-core which does not cater to any specific HTTP framework.

Here's an example usage and reference implementation I did for the awilix-koa package.

All the builder + decorator stuff resides in awilix-router-core, all you need to do is register the result with app.get|post|... as seen in the reference implementation.

Would you be willing to work on this? If you need any help or if something could be more clear, please let me know.

Thanks again for maintaining awilix-express! 😄

talyssonoc commented 6 years ago

Hello @jeffijoe, I really liked the idea of awilix-router-core! It's good to have a base like that to build integrations on. I'm gonna work on that soon, thanks for the heads up!

jeffijoe commented 6 years ago

Excellent, let me know if you get stuck. 😄

Also, you'll have to set the awilix peerDependency + devDependency to "awilix": ">=2.11.1 <3.0.0", as container.build was introduced in 2.11. Relevant docs on container.build() here.

talyssonoc commented 6 years ago

Hey @jeffijoe, sorry for the delay on that. I'm working on it and got stuck in the after decorator. Express doesn't support to set new headers after the body is already sent so the controller tests are failing. Do you think it would be better to not expose the after in awilix-express or change the test to something that is possible with express?

jeffijoe commented 6 years ago

Feel free to make the tests more Express-friendly. 😄