Why and how to use service injection in Node.js

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • Appwrite - The open-source backend cloud platform
  • SurveyJS - A Non-Cloud Alternative to Google Forms that has it all.
  • Amplication - open-source Node.js backend code generator
  • Mergify - Updating dependencies is time-consuming.
  • Sonar - Write Clean JavaScript Code. Always.
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • nwire

    Simplified dependency injection in Node.js

    This is not necessarily true. Dependency injection allows you to provide your own implementations for unit testing. I'm surprised we're still talking about dependency injection in Node.js. I made a really crude dependency injection library for Node six years ago.


  • ashley

    Ashley is a dependency injection container for JavaScript. (by jiripospisil)

    Yeah, this is more like the "Service locator" pattern where you use a single object (the locator) to bring in other objects. Years ago I wrote dependency injection container for JavaScript [0] and under the hood it indeed works similarly to a service locator but the difference is in the usage. Your application code should have no knowledge of where the constructed object is coming from, it should not explicitly grab it from a global object.

    [0] https://github.com/jiripospisil/ashley

  • Appwrite

    Appwrite - The open-source backend cloud platform. The open-source backend cloud platform for developing Web, Mobile, and Flutter applications. You can set up your backend faster with real-time APIs for authentication, databases, file storage, cloud functions, and much more!

  • tsyringe

    Lightweight dependency injection container for JavaScript/TypeScript

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts