Closed lzanoni-stm closed 8 months ago
Perhaps you could try to create a regular expression that finds those significant parts. Something like:
$routes = file_get_contents('routes.php');
preg_match_all( "/Flight::route\('(.*)',[\n\r\s]+function\((.*)\){/", $routes, $matches );
foreach ($matches as $match) { var_dump($match); }
May be too late, but you can list all routes with
\Flight::router()->getRoutes()
As of adding a description for a route, you can use Flight::map
to create a new routing method that points to the original one, or override Flight's routing method and add new params to store the method name.
Seems resolved with the last comment.
Hello, I'm using Flight to create an API for a service. I'd like to auto-describe as much as possible (that is without writing a README on the APIs exposed) Is there a way to more or less automatically get the list of the routes (with their method) ? GET /api/things GET /api/thing/@id
Is it possible to 'hint' the optional or required parameters expected in the query string, but not in the URL route like /api/thing/@id?value=newvalue and finally, would it be possible to add a 'description' field when adding a route ? Flight::route('GET /languagesets', function(){ AsJSON(LanguageSet::ListSets(),"List the languages"); });