Created
May 5, 2016 13:52
-
-
Save leemason/45966ddec67eed6d53ef14e83bb04550 to your computer and use it in GitHub Desktop.
Manual Invocation
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
let db = require('db_module'), | |
config = require('config'); | |
let DB = new db(config.db); | |
// Now you can use DB | |
export default class Controller{ | |
postIndex(req, res){ | |
DB.insert('table', req.get('data')); | |
} | |
} |
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
//example of a module that needs "something" to be given for its usage | |
export default class DB{ | |
constructor(config){ | |
this.config = config; | |
} | |
select(){ | |
// select code | |
} | |
insert(){ | |
// insert | |
} | |
// etc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment