var knex = require('knex');
app.get('/example/:param',
loadWithParam(),
updateWithParam(),
render.staticOK()
function loadWithParam() {
return function(req, res, next) {
var db = knex({conConfig});
db(tableName).where(field, req.params.param).select().then(function(rows) {
db.destroy(function() {
res.locals[tableName] = rows;
next();
});
}).catch(function(err) {
...
});
};
}
function updateWithParam() {
return function(req, res, next) {
if(res.locals[tableName].length === 0) {
return next();
}
var db = knex({conConfig});
db(tableName).where(field, req.params.param).update({field: value}).then(function() {
db.destroy(function() {
next();
});
}).catch(function(err) {
...
});
};
}
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/408d3fd6-dd6c-4621-9030-99ff2e3fe7d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my LG Mobile
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/bb064078-9578-4082-b74a-284bac1092f5%40googlegroups.com.
I'm really curious about why your data needs to be 'split correctly'. If the table structures are the same, couldn't you include everything together and just put Master/Userscheme info in WHERE clauses?
I can't speak for this person, specifically, but at my work we have legal requirements for keeping customer data separate. We also have SLAs for delivering analytics on this data and so keeping them on separate DB instances (and physical machines) allows us to actually fulfill these guarantees.
Sometimes there are valid reasons to split very similar databases.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAFDWy%2BtPPkHs70X3FnnfYt2584f2Nw2x0M9TChDzu4%3Dp0Vd3AA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAFDWy%2BtPPkHs70X3FnnfYt2584f2Nw2x0M9TChDzu4%3Dp0Vd3AA%40mail.gmail.com.