Created
November 22, 2014 16:57
-
-
Save markstory/76a8c2e3af3da787a6b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Router::scope('/', function ($routes) { | |
$routes->extensions('json'); | |
/** | |
* 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, src/Template/Pages/home.ctp)... | |
*/ | |
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']); | |
/** | |
* ...and connect the rest of 'Pages' controller's URLs. | |
*/ | |
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']); | |
/** | |
* Connect a route for the index action of any controller. | |
* And a more general catch all route for any action. | |
* | |
* The `fallbacks` method is a shortcut for | |
* `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'InflectedRoute']);` | |
* `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'InflectedRoute']);` | |
* | |
* You can remove these routes once you've connected the | |
* routes you want in your application. | |
*/ | |
$routes->fallbacks(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPATCH -H 'Content-Type: application/json' -H 'Accept: application/json' cake3.localhost/tags/edit/2 -d '{"title": "some new title"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment