kvz / cakephp-rest-plugin

Discontinued: recent cakephp versions overlap functionality, there also is @ceeram's plugin. Painless REST server Plugin for CakePHP
http://kvz.io/blog/2010/01/13/cakephp-rest-plugin-presentation/
169 stars 37 forks source link

Making Ready for production #1

Closed veritech closed 14 years ago

veritech commented 14 years ago

I had just started working on a cake 1.3 REST api of my own, when i saw this. You note that it's not ready for production use. What are the key things it needs?

I've forked the project already, and i'm happy to push some commits if you could identify the areas of focus.

Thanks

kvz commented 14 years ago

Cool, let's work together. These areas could use some help still:

But that being said, I already use it in my environment in conjunction with our API: http://github.com/true/true-api/

that works like this: $servers = $this->TrueApi->Servers->index(); $this->TrueApi->Servers->edit(2862, array('model' => 'Dell 2950'));

veritech commented 14 years ago

I've got basic XML support working, and i'll need to write some tests, and then push my fork

kvz commented 14 years ago

How cool is that! I'm looking forward to check it out!

veritech commented 14 years ago

I've updated my fork http://github.com/veritech/cakephp-rest-plugin. Some of the behaviour of the component confused me a little, so most of my "improvements" are more like hacks. However the major thing i did was to replace your approach of XML/JSON generation and using View Classes instead, much cleaner and more extensible, (Check out the views folder)

kvz commented 14 years ago

Very good. I like your approach with the View Class. I think I'm keeping the die & headers though. For me it's crucial that the process dies immediately when abort is called as this is also used by authentication. I haven't found a better (failsafe) way yet.

kvz commented 14 years ago

Send me a pull request if you want, then I'll pull in your changes and take it from there

veritech commented 14 years ago

I removed the die in my attempt to find a better way to route the error information through the view classes. As you can see i never did. :(

kvz commented 14 years ago

I now make the encode() functions available to the component as a compromise. Made some other changes as well, hope you like them

veritech commented 14 years ago

Looking very nice, i could see from the commit msg you were quite proud of yourself! Huge thanks for mention also.

kvz commented 14 years ago

well sometimes you've got to be. otherwise what's the fun : )

and oh, I also updated my client so it can decode the xml we now talk. may be of interest to you: http://github.com/true/true-api/blob/master/Xml.php

btw are you on twitter as well?

veritech commented 14 years ago

@veritech

kvz commented 14 years ago

right.. :)