Skip to content

Instantly share code, notes, and snippets.

@SamanShafigh
Last active November 1, 2018 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamanShafigh/a6c0e81a637fd066ab607dacfb3a605f to your computer and use it in GitHub Desktop.
Save SamanShafigh/a6c0e81a637fd066ab607dacfb3a605f to your computer and use it in GitHub Desktop.
import {MongoClient} from 'mongodb';
import UserController from './controller/user-controller';
import UserService from './service/user-service'
import MongoDriver from './service/db-service';
import Config from './service/config-service';
export const config = {
constructor: () => new Config(process.env),
tags: ['boot']
}
export const userController = {
constructor: (container) => new UserController(container.get('userService')),
}
export const userService = {
constructor: (container) => new UserService(container.get('db')),
}
export const mongoClient = {
constructor: () => MongoClient,
}
export const db = {
constructor: (container) => new MongoDriver(container.get('mongoClient'), container.get('config')),
tags: ['boot']
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment