diff --git a/src/routes/admin.js b/src/routes/admin.js index cd3994f144..47331ea8aa 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -244,7 +244,7 @@ var nconf = require('nconf'), var custom_routes = { 'routes': [], - 'api_methods': [] + 'api': [] }; plugins.ready(function() { @@ -264,6 +264,19 @@ var nconf = require('nconf'), }(route)); } } + + var apiRoutes = custom_routes.api; + for (var route in apiRoutes) { + if (apiRoutes.hasOwnProperty(route)) { + (function(route) { + app[apiRoutes[route].method || 'get']('/admin/api' + apiRoutes[route].route, function(req, res) { + apiRoutes[route].callback(req, res, function(data) { + res.json(data); + }); + }); + }(route)); + } + } }); });