setRouteClass(DashedRoute::class); $routes->scope('/', function (RouteBuilder $builder): void { /* * Here, we are connecting '/' (base path) to a controller called 'Pages', * its action called 'display', and we pass a param to select the view file * to use (in this case, templates/Pages/home.php)... */ $builder->connect('/', ['controller' => 'Tools','action' => 'index']); /* * ...and connect the rest of 'Pages' controller's URLs. */ $builder->connect('/pages/*', 'Pages::display'); /* * Connect catchall routes for all controllers. * * The `fallbacks` method is a shortcut for * * ``` * $builder->connect('/{controller}', ['action' => 'index']); * $builder->connect('/{controller}/{action}/*', []); * ``` * * It is NOT recommended to use fallback routes after your initial prototyping phase! * See https://book.cakephp.org/5/en/development/routing.html#fallbacks-method for more information */ $builder->fallbacks(); }); /* * If you need a different set of middleware or none at all, * open new scope and define routes there. * * ``` * $routes->scope('/api', function (RouteBuilder $builder): void { * // No $builder->applyMiddleware() here. * * // Parse specified extensions from URLs * // $builder->setExtensions(['json', 'xml']); * * // Connect API actions here. * }); * ``` */ };