Created
December 10, 2014 03:09
-
-
Save markstory/5438ce0012999ffb4b9d 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::parseExtensions('json'); | |
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); | |
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); | |
CakePlugin::routes(); | |
require CAKE . 'Config' . DS . 'routes.php'; |
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 | |
App::uses('AppController', 'Controller'); | |
class TasksController extends AppController { | |
public $components = ['Session', 'Paginator', 'RequestHandler']; | |
public function index() { | |
$this->Task->recursive = 0; | |
$this->Paginator->settings = $this->paginate; | |
$this->Paginator->settings['limit'] = 16; | |
$this->set('tasks', $this->Paginator->paginate()); | |
$this->set('_serialize', ['tasks']); | |
} | |
} |
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 -XGET -v cake.localhost/tasks.json | |
* Adding handle: conn: 0x7ff24b804000 | |
* Adding handle: send: 0 | |
* Adding handle: recv: 0 | |
* Curl_addHandleToPipeline: length: 1 | |
* - Conn 0 (0x7ff24b804000) send_pipe: 1, recv_pipe: 0 | |
* About to connect() to cake.localhost port 80 (#0) | |
* Trying 127.0.0.1... | |
* Connected to cake.localhost (127.0.0.1) port 80 (#0) | |
> GET /tasks.json HTTP/1.1 | |
> User-Agent: curl/7.30.0 | |
> Host: cake.localhost | |
> Accept: */* | |
> | |
< HTTP/1.1 200 OK | |
< Date: Wed, 10 Dec 2014 03:07:50 GMT | |
* Server Apache/2.2.26 (Unix) DAV/2 PHP/5.4.32 mod_ssl/2.2.26 OpenSSL/0.9.8za is not blacklisted | |
< Server: Apache/2.2.26 (Unix) DAV/2 PHP/5.4.32 mod_ssl/2.2.26 OpenSSL/0.9.8za | |
< X-Powered-By: PHP/5.4.32 | |
< Content-Length: 15719 | |
< Content-Type: application/json; charset=UTF-8 | |
< | |
{ | |
"tasks": [ | |
{ | |
"Task": { | |
"id": "1", | |
"milestone_id": "1", | |
"user_id": "1", | |
"title": "go go power rangers.", | |
"description": "testing", | |
"completed": false, | |
"created": "2012-07-16 21:21:04", | |
"modified": "2014-06-16 02:48:42" | |
}, | |
"Milestone": { | |
"id": "1", | |
"title": "Kick ass", | |
"description": "aww yeah", | |
"due_date": "2012-07-15", | |
"completed": false, | |
"project_id": "1", | |
"created": "2012-07-15 19:46:49", | |
"modified": "2012-07-15 19:46:49" | |
}, | |
"User": { | |
"id": "1", | |
"username": "mark", | |
"password": "ebdcb0d611eee4e2509632e2644b96d3906d8be6", | |
"created": "2012-09-14 09:35:36", | |
"modified": "2012-09-14 09:35:36" | |
} | |
} | |
] | |
} | |
* Connection #0 to host cake.localhost left intact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment