/blog/2015/04/how-to-prefix-route-a-cakephp-3-rest-api/ #155
Replies: 4 comments 6 replies
-
|
Sascha Müller [DISQUS]: Hello, when creating an api-prefix and copying all relevant controllers into that directory, the code won't be DRY... Or did I misunderstand sth.? E.g. I have a modules-controller. On the website I can add,edit,remove,view my modules. The add-action does some more than only add modules (e.g.). When I want to make the modules accessable via the api, I do have to make a copy of the modules-controller to the api-dir, so I have this controller twice. I understood this article like this. Is this correct and how can I prevent this? Or is the only way not to make a prefix, but a new scope "/api". |
Beta Was this translation helpful? Give feedback.
-
Problem solved!I had created an 'api' directory, not 'Api'. ;D ProblemHi, I'm getting a 404 (Cocktails controller not found) when I test the routes. All other steps of this series are OK in my case. I'm trying the url config/routes.php: src/Controller/api/CocktailsController.php: src/Controller/api/AppController.php: |
Beta Was this translation helpful? Give feedback.
-
|
andrew1980uk [DISQUS]: Hi mate, thanks for the tutorial it's really good and has taught me a lot. Quick question... How would you go about doing multiple inserts/adds? Say I want to add more than one row at a time. I can see there are CRUD bulk actions for delete and update but I can't see anything for inserting. Does the fact it wasn't added to the CRUD plugins bulk actions mean you should just fire multiple 'add' requests off via the API? |
Beta Was this translation helpful? Give feedback.
-
|
T Hess [DISQUS]: I keep getting "Missing CSRF token cookie". I've tried so many different things from from different sorces but have not been able to get this error yto go away. I'm trying to access my CakePhp site API from another sub domain (non-Cakephp) but it gives me thie CSRF error. I'm using Cakephp 3.7. Do you have any suggest of where I can find an answer for this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How to prefix route a CAKEPHP 3 REST API
https://www.bravo-kernel.com/blog/2015/04/how-to-prefix-route-a-cakephp-3-rest-api/
Beta Was this translation helpful? Give feedback.
All reactions