null+****@clear*****
null+****@clear*****
2012年 6月 21日 (木) 17:48:56 JST
SHIMODA Hiroshi 2012-06-21 17:48:56 +0900 (Thu, 21 Jun 2012) New Revision: 7083e2cea4bfe1a5d8d5203e939835d022d5ce9c https://github.com/groonga/gcs/commit/7083e2cea4bfe1a5d8d5203e939835d022d5ce9c Log: Split dashboard from configuration API Added files: lib/dashboard.js Modified files: lib/api/2011-02-01/configuration.js lib/server.js Modified: lib/api/2011-02-01/configuration.js (+5 -8) =================================================================== --- lib/api/2011-02-01/configuration.js 2012-06-21 17:44:50 +0900 (6f121df) +++ lib/api/2011-02-01/configuration.js 2012-06-21 17:48:56 +0900 (c73d9ec) @@ -188,18 +188,15 @@ handlers.DefineIndexField = function(database, request, response) { }); }; -function dashboardHandler(request, response) { - return response.render('index.jade'); -} - exports.createHandler = function(database) { - return function(request, response) { + return function(request, response, next) { var message, body; + // GCS specific behaviour: fallback to other handlers for the endpoint + // if no action is given. var action = request.query.Action || ''; - if (!action) { - return dashboardHandler(request, response); // GCS original behaviour - } + if (!action) + return next(); var version = request.query.Version; if (!version) { Added: lib/dashboard.js (+4 -0) 100644 =================================================================== --- /dev/null +++ lib/dashboard.js 2012-06-21 17:48:56 +0900 (ce7a723) @@ -0,0 +1,4 @@ +function handler(request, response) { + return response.render('index.jade'); +} +exports.handler = handler; Modified: lib/server.js (+3 -0) =================================================================== --- lib/server.js 2012-06-21 17:44:50 +0900 (9282898) +++ lib/server.js 2012-06-21 17:48:56 +0900 (03c77a6) @@ -1,6 +1,7 @@ var express = require('express'); var Database = require('./database').Database; var api = require('./api'); +var dashboard = require('./dashboard'); exports.createServer = function (config) { var database = new Database(config.database || config.databasePath); @@ -12,5 +13,7 @@ exports.createServer = function (config) { api[version].registerHandlers(application, database); }); + application.get('/', dashboard.handler(database)); + return application; }; -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download