Merge pull request #315 from laf/issue-laf-58

Added the ability to call the api for a list of endpoints
This commit is contained in:
Paul Gear
2014-10-22 21:46:34 +10:00
2 changed files with 14 additions and 0 deletions

View File

@ -479,3 +479,16 @@ function get_vlans() {
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}
function show_endpoints() {
global $config;
$app = \Slim\Slim::getInstance();
$routes = $app->router()->getNamedRoutes();
$output = array();
foreach($routes as $route) {
$output[$route->getName()] = $config['base_url'].$route->getPattern();
}
$app->response->setStatus('200');
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}