composer require sprintcube 2fcakephp rest

Solutions on MaxInterview for composer require sprintcube 2fcakephp rest by the best coders in the world

showing results for - "composer require sprintcube 2fcakephp rest"
Lucas
16 Feb 2017
1composer require sprintcube/cakephp-rest
2
3
4bin/cake plugin load -b Rest
5
6
7$routes->connect('/foo/bar', ['controller' => 'Foo', 'action' => 'bar', 'isRest' => true]);
8
9
10namespace App\Controller\Api;
11use Rest\Controller\RestController;
12class ProductsController extends RestController
13
14public function beforeFilter(Event $event)
15{
16parent::beforeFilter($event);
17      
18$this->response->cors($this->request)
19->allowOrigin('*')
20->allowMethods(['GET', 'PUT', 'POST', 'OPTIONS'])
21->allowHeaders(['X-CSRF-Token'])
22->allowCredentials()
23->maxAge(300)
24->build();
25}
26
27