Initial go at [#448]

This commit is contained in:
reality 2013-05-17 13:29:28 +00:00
parent f4f34d2852
commit 15fd9c32e4
2 changed files with 37 additions and 0 deletions

View File

@ -5,6 +5,22 @@
var _ = require('underscore')._; var _ = require('underscore')._;
var api = function(dbot) { var api = function(dbot) {
this.pages = {
'/api': function(req, res) {
var externalApi = {};
_.each(dbot.api, function(moduleApi, moduleName) {
externalApi[moduleName] = {};
_.each(moduleApi, function(method, methodName) {
if(method.external == true) {
externalApi[moduleName][methodName] = method.extMap;
}
});
});
res.render('api', { 'name': dbot.config.name, 'api': externalApi });
}
};
this.onLoad = function() { 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,

21
views/api/api.jade Normal file
View File

@ -0,0 +1,21 @@
extends ../layout
block content
div#backlink
a(href='/') « Home
div#row
h4 External API Functions
div#row
table.tabe.table-hover.data
thead
tr
th Module
th Path
th Arguments
tbody
-each module,moduleName in api
-each func,funcName in api[moduleName]
tr
td #{moduleName}
td /api/#{moduleName}/#{funcName}
td #{func}