From 5da4d88ad9311dd5755a4c2951e1ffc7aa13ce83 Mon Sep 17 00:00:00 2001 From: reality Date: Fri, 17 May 2013 14:13:42 +0000 Subject: [PATCH] api root in onLoad --- modules/api/api.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/api/api.js b/modules/api/api.js index 408dc0a..e05fe18 100644 --- a/modules/api/api.js +++ b/modules/api/api.js @@ -5,8 +5,8 @@ var _ = require('underscore')._; var api = function(dbot) { - this.pages = { - '/api': function(req, res) { + this.onLoad = function() { + dbot.modules.web.app.get('/api': function(req, res) { var externalApi = {}; _.each(dbot.api, function(moduleApi, moduleName) { externalApi[moduleName] = {}; @@ -18,10 +18,8 @@ var api = function(dbot) { }); res.render('api', { 'name': dbot.config.name, 'api': externalApi }); - } - }; + }); - this.onLoad = function() { dbot.modules.web.app.get('/api/:module/:method', function(req, res) { var module = req.params.module, method = req.params.method,