Instantly expose a data table as JSON/REST with Delphi.
[UPDATE] For a more complete example of building a RESTful service client with Delphi, and a RESTful JSON service using PHP, check out my “Brutally Roll Your Own Backend” video series!
Since my skill sprint on JSON/REST services in Delphi and C++ builder back in February, one thing has been nagging on my mind. The code that I wrote for that skill sprint was written specifically to expose one particular database table, but it was almost generic enough that it could expose any database table. So why don’t I write a component for exposing tables as JSON/REST endpoints?
Well, for the past two or three days I’ve been working on just such a component, and I’d now like to demonstrate for you, just how easy it can be to create a JSON/REST service application using it. The server side component, when placed into a WebBroker application module, automatically adds an endpoint, and you simply need to bind the component up to a database connection to make it function.
This video demonstrates how to install and use the component…
I must apologize for needing a disclaimer, but I’m sure you’ll understand why it’s necessary…
Before I hand you the source code for this component, and demonstrate it’s use, I’d like to make one thing very clear. I wrote this component (actually two components) for no other purpose than to demonstrate that it could be done. I wouldn’t want you to think that this code is in any way safe for commercial use. I do provide these components free of charge, and welcome you to use them for any purpose, however, as it is not commercial grade code I will not be held responsible if you use it and incur damages. I would be happy to entertain volunteers that wish to review and enhance the code, add unit tests, add injection protection, authentication and so on, however, I will not personally be investing in this code any further. Okay?
Okay, so the source code is may be downloaded here: JCRUD
Thanks for reading!