plugins - added api routes to filter:admin.create_routes

v1.18.x
psychobunny 11 years ago
parent 25bac03bab
commit 58a3f33200

@ -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));
}
}
});
});

Loading…
Cancel
Save