-
-
Save dmorosinotto/6925466 to your computer and use it in GitHub Desktop.
This file contains 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
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