adding example apps, fixing powerup issues
[feisty_meow.git] / production / example_apps / zippy_maps / config / routes.php
1 <?php
2 /**
3  * Routes configuration
4  *
5  * In this file, you set up routes to your controllers and their actions.
6  * Routes are very important mechanism that allows you to freely connect
7  * different URLs to chosen controllers and their actions (functions).
8  *
9  * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
10  * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11  *
12  * Licensed under The MIT License
13  * For full copyright and license information, please see the LICENSE.txt
14  * Redistributions of files must retain the above copyright notice.
15  *
16  * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
17  * @link          http://cakephp.org CakePHP(tm) Project
18  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
19  */
20
21 use Cake\Core\Plugin;
22 use Cake\Routing\RouteBuilder;
23 use Cake\Routing\Router;
24 use Cake\Routing\Route\DashedRoute;
25
26 /**
27  * The default class to use for all routes
28  *
29  * The following route classes are supplied with CakePHP and are appropriate
30  * to set as the default:
31  *
32  * - Route
33  * - InflectedRoute
34  * - DashedRoute
35  *
36  * If no call is made to `Router::defaultRouteClass()`, the class used is
37  * `Route` (`Cake\Routing\Route\Route`)
38  *
39  * Note that `Route` does not do any inflections on URLs which will result in
40  * inconsistently cased URLs when used with `:plugin`, `:controller` and
41  * `:action` markers.
42  *
43  */
44 Router::defaultRouteClass(DashedRoute::class);
45
46 // enable json and xml extensions in routes.
47 Router::extensions(['json', 'xml']);
48
49 Router::scope('/', function (RouteBuilder $routes) {
50     /**
51      * Here, we are connecting '/' (base path) to a controller called 'Pages',
52      * its action called 'display', and we pass a param to select the view file
53      * to use (in this case, src/Template/Pages/home.ctp)...
54      */
55     $routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
56
57     /**
58      * ...and connect the rest of 'Pages' controller's URLs.
59      */
60     $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
61     
62     // enable the categories controller to function as an API.    
63         $routes->resources('Categories',
64                 [ 'actions' => ['create' => 'lookupajax'] ]);
65         // enable the locations controller to function as an API.
66         $routes->resources('Locations',
67                         [ 'actions' => ['create' => 'lookupajax'] ]);
68         
69     
70     /**
71      * Connect catchall routes for all controllers.
72      *
73      * Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
74      *    `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
75      *    `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
76      *
77      * Any route class can be used with this method, such as:
78      * - DashedRoute
79      * - InflectedRoute
80      * - Route
81      * - Or your own route class
82      *
83      * You can remove these routes once you've connected the
84      * routes you want in your application.
85      */
86     $routes->fallbacks(DashedRoute::class);
87 });
88
89 /**
90  * Load all plugin routes.  See the Plugin documentation on
91  * how to customize the loading of plugin routes.
92  */
93 Plugin::routes();