Wednesday, July 2, 2014

Grouping Api controllers in a seperate sub directory

Hi,

I have an app which requires some Api to expose its services. I am trying to group all the Api related controllers in a directory as explained in the doc here : http://book.cakephp.org/2.0/en/development/configuration.html

So :
1- I created a /app/Controller/Api folder and moved the controllers in it.
2- added this code to my bootstrap.php : App::build(array('Controller' => array( DS . 'app' . DS . 'Controller', DS . 'app' . DS . 'Controller' . DS . 'Api',), ));

When I try to call one of the actions I get an error saying the controller cannot be found :

http://localhost:8888/XXXXX/api/articles.json

returns 

{"code":404,"name":"Controller class ArticlesController could not be found.","message":"Controller class ArticlesController could not be found.","url":"\/XXXX\/api\/articles.json"}


Anyone can help me figuring out what is missing please? The doc seems so clear...

Thanks!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: