YUKI Hiroshi
null+****@clear*****
Tue Feb 5 17:47:22 JST 2013
YUKI Hiroshi 2013-02-05 17:47:22 +0900 (Tue, 05 Feb 2013) New Revision: ba2b0d17e87ce61978c572d4b7ce4e79879f2d4b https://github.com/groonga/express-kotoumi/commit/ba2b0d17e87ce61978c572d4b7ce4e79879f2d4b Log: Process plugin command sets and unified command set in same way Modified files: lib/frontend/rest-adaptor.js Modified: lib/frontend/rest-adaptor.js (+9 -12) =================================================================== --- lib/frontend/rest-adaptor.js 2013-02-05 17:36:10 +0900 (352e076) +++ lib/frontend/rest-adaptor.js 2013-02-05 17:47:22 +0900 (340de99) @@ -61,23 +61,20 @@ exports.register = function(application, params) { Object.keys(commandSets).forEach(function(command) { var definition = commandSets[command]; - if (definition.method) - unifiedCommandSet[command] = definition; + if (!definition.method) return; // ignore non-REST command + unifiedCommandSet[command] = definition; }); }); Object.keys(unifiedCommandSet).forEach(function(command) { var definition = unifiedCommandSet[command]; - if (!definition.method) - return; + if (!definition.method) return; // ignore not a command definition var method = getRegisterationMethod(definition.method); - application[method]( - prefix + definition.path, - createHandler({ - connection: connection, - command: command, - requestBuilder: definition.requestBuilder - }) - ); + var handler = createHandler({ + connection: connection, + command: command, + requestBuilder: definition.requestBuilder + }); + application[method](prefix + definition.path, handler); }); } -------------- next part -------------- HTML����������������������������... 下載