mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 12:29:26 +01:00
Initial go at [#448]
This commit is contained in:
parent
f4f34d2852
commit
15fd9c32e4
@ -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
21
views/api/api.jade
Normal 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}
|
Loading…
Reference in New Issue
Block a user