api_router - allow parameters as final path argument

(cherry picked from commit 47001c3303)
This commit is contained in:
zotlabs 2019-03-05 04:11:43 +00:00 committed by Mario
parent 6a3cfe54af
commit d407e5556e

View File

@ -12,8 +12,16 @@ class Api_router {
} }
static function find($path) { static function find($path) {
if(array_key_exists($path,self::$routes)) if (array_key_exists($path,self::$routes)) {
return self::$routes[$path]; return self::$routes[$path];
}
$with_params = dirname($path) . '/[id]';
if (array_key_exists($with_params,self::$routes)) {
return self::$routes[$with_params];
}
return null; return null;
} }