Skip to content

Instantly share code, notes, and snippets.

@dmorosinotto
Forked from joshtwist/read.js
Created October 10, 2013 20:51
Show Gist options
  • Save dmorosinotto/6925466 to your computer and use it in GitHub Desktop.
Save dmorosinotto/6925466 to your computer and use it in GitHub Desktop.
function read(query, user, request) {
var dispatch = {
op1 : operation1,
op2 : operation2,
}
if (request.parameters.operation && dispatch.hasOwnProperty(request.parameters.operation)) {
dispatch[request.parameters.operation](query, user, request);
return;
}
else
{
// default path for execution
request.execute();
}
}
function operation1(query, user, request) {
request.respond(200, "this result is from operation1");
}
function operation2(query, user, request) {
request.respond(200, "this result is from operation2");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment