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
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • nwire

    Simplified dependency injection in TypeScript

  • 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.

    https://github.com/divmgl/nwire

  • 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

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • 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