Jump to content

lemgrago

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by lemgrago

  1. Has anyone here done multi-level endpoints (e.g. /api/firstlevel/secondlevel)? I thought the $routes variable in Routes.php would end up looking like: $routes = [ ['OPTIONS', 'test', RestApiHelper::class, 'preflight', ['auth' => false]], // this is needed for CORS Requests ['GET', 'test', Example::class, 'test'], // The multi-level stuff 'firstlevel' => [ 'secondlevel' => [ ['OPTIONS', '', RestApiHelper::class, 'preflight', ['auth' => false]], ['POST', '', MyEndpoints::class, 'secondlevelHandler'] ] ] 'users' => [ ['OPTIONS', '', RestApiHelper::class, 'preflight', ['auth' => false]], // this is needed for CORS Requests ['GET', '', Example::class, 'getAllUsers', ["auth" => false]], ['GET', '{id:\d+}', Example::class, 'getUser', ["auth" => false]], // check: https://github.com/nikic/FastRoute ], ]; But, apparently that doesn't work. Anyone know how to do this?
×
×
  • Create New...