Created
November 29, 2016 09:13
-
-
Save Pyrolistical/4348d128ee811e6239ba3e8d89d42615 to your computer and use it in GitHub Desktop.
Factory Function Injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MongoClient = require('mongodb').MongoClient | |
const Controller = require('./controller') | |
const Service = require('./service') | |
const Repository = require('./repository') | |
MongoClient.connect('some mongo url') | |
.then((db) => { | |
const repository = Repository(db) | |
const service = Service(repository) | |
const controller = Controller(service) | |
controller.doTheThing() | |
}) | |
.catch(console.log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment