Skip to content

Instantly share code, notes, and snippets.

@Noerdsteil
Created December 19, 2019 16:39
Show Gist options
  • Save Noerdsteil/9b4c088f263205ebbfc1ccd82d080b12 to your computer and use it in GitHub Desktop.
Save Noerdsteil/9b4c088f263205ebbfc1ccd82d080b12 to your computer and use it in GitHub Desktop.
How services are loaded before and after
// Contructor based DI (intermediary solution we had before)
const UserService = require('../user/userService')
const userService = new UserService(crmService, lhNotifier, userPropertyService)
// Note: All of the required services had to be managed in each occurrence
// Consistency was not the only pain we had
// With DI container in place
const { container, types } = require('../dependencyContainer')
const userService = container.get(types.UserService)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment