View Full Version : recommended RESTful mysql backend

21 Apr 2010, 1:51 PM
I just started looking at the ext js 3.2.0 examples and the RESTful Store Example is similar to what I'm looking for. I want to write a single-page web app that access records from a mysql database. From my reading, it seems that there is no single agreed upon RESTful api, is that right?
Either way, is there a recommended backend to use with ext js to access mysql data? I'd prefer php or C on the server side, and as little configuration and coding as possible. I know how to take the example and code this myself, but I'm hoping it's been done already.

Thanks for any suggestions,

26 Apr 2010, 7:46 AM
I'm wondering the same thing. In my app, I currently have one PHP file that is a data source to populate a tree, one PHP file that is a text-parsing function to accept incoming data from a form, and one PHP file that generates a web page with my output. Since all of these are actually part of the same application, the code designer in me wants to wrap all of these (and there will be more) into the same file and make them methods of a class. Is this the best approach? Should data sources be static methods and called with $obj::method? When does the context and therefore all of the instances of classes disappear? Are there any good examples of what a multi-data-source, multi-method PHP backend for ExtJS looks like?

26 Apr 2010, 7:50 AM

Regarding the part of your question related to grabbing MySQL data, I don't know that I can be too much help on this. The API that I have settled on is the MODx DBAPI. I chose it primarily because I'm a big MODx CMF fan and it works well for me in that environment. You might want to check it out. I use MODx to implement my ExtJS backend functions. In fact, ExtJS is used (along with MooTools for whatever reason) to implement the MODx manager interface. http://modxcms.com/

26 Apr 2010, 7:58 AM
I've been looking into this further, and have set up a test with Ext.direct and the example php backend in the file ext-direct-php-1.01.zip.
Here are 2 links that discuss this approach:

It works the way you mentioned, there is one entry point, and each function is a class member. The returned results are JSON data. The only problem I currently have with it is how to secure it. The client side doesn't seem to have a good way to catch a "not logged in" error and handle it cleanly in one place, then retry the original request.
This interface is not really RESTful, but more powerful in that you can call any exported server functions from the client.