forked from GitHub/dbot
api root in onLoad
This commit is contained in:
parent
1127d11a0e
commit
5da4d88ad9
@ -5,8 +5,8 @@
|
|||||||
var _ = require('underscore')._;
|
var _ = require('underscore')._;
|
||||||
|
|
||||||
var api = function(dbot) {
|
var api = function(dbot) {
|
||||||
this.pages = {
|
this.onLoad = function() {
|
||||||
'/api': function(req, res) {
|
dbot.modules.web.app.get('/api': function(req, res) {
|
||||||
var externalApi = {};
|
var externalApi = {};
|
||||||
_.each(dbot.api, function(moduleApi, moduleName) {
|
_.each(dbot.api, function(moduleApi, moduleName) {
|
||||||
externalApi[moduleName] = {};
|
externalApi[moduleName] = {};
|
||||||
@ -18,10 +18,8 @@ var api = function(dbot) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
res.render('api', { 'name': dbot.config.name, 'api': externalApi });
|
res.render('api', { 'name': dbot.config.name, 'api': externalApi });
|
||||||
}
|
});
|
||||||
};
|
|
||||||
|
|
||||||
this.onLoad = function() {
|
|
||||||
dbot.modules.web.app.get('/api/:module/:method', function(req, res) {
|
dbot.modules.web.app.get('/api/:module/:method', function(req, res) {
|
||||||
var module = req.params.module,
|
var module = req.params.module,
|
||||||
method = req.params.method,
|
method = req.params.method,
|
||||||
|
Loading…
Reference in New Issue
Block a user