Skip to content

Instantly share code, notes, and snippets.

@leemason
Created May 5, 2016 13:52
Show Gist options
  • Save leemason/45966ddec67eed6d53ef14e83bb04550 to your computer and use it in GitHub Desktop.
Save leemason/45966ddec67eed6d53ef14e83bb04550 to your computer and use it in GitHub Desktop.
Manual Invocation
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'));
}
}
//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