Skip to content

Instantly share code, notes, and snippets.

@scarvell
Created February 24, 2014 06:41
Show Gist options
  • Save scarvell/9182985 to your computer and use it in GitHub Desktop.
Save scarvell/9182985 to your computer and use it in GitHub Desktop.
client.connect(function(){
module.exports = client;
});
---------------------------------
pg.connect(conString, function(err, client, done) {
module.exports = {client: client, done:done};
});
-- OR --
pg.connect(conString, function(err, client, done) {
module.exports = someFunction(){
client.query.apply(client, arguments);
done();
};
});
------------------------------
var db = require('pgstuff');
app.get('/users/:id', function (req,res){
db.client.query("some query", function(){
db.done();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment