Does anyone remember FileMaker Pro? Like freedom, it was both wonderful and horrible at the same time… but one of the things that made it wonderful was the idea that you could use it to create a database on your computer and share it with other computers running FMP on the same network. It could be a list of employee phone numbers or the latest pricing from distribution… you could simply turn on sharing and others could connect to your data. Likewise, you could look out on the network and connect to any FMP database that was being shared.
I’m pretty sure that I know the answer to this question but basically, I would like to know if it’s possible to run a RESTful API to serve a database using the Desktop version of Xojo. Ideally, I’d like to bake the server right into the same app that acts as the client.
Seeing that I can’t seem to fine HandleSpecialURL anywhere in Desktop, I have a feeling that the answer is to create two apps, a Web app to be the REST server and a Desktop app to be the client.
It’s possible, but you would need a helper app acting as server side-by-side to your desktop app. By saying that I have to add that this is a bad application design. You’re setting up a local service, which needs an open port and makes your client computer vulnerable. You have to decide how to control this service to prevent running when your desktop app has stopped intendedly or unintendedly. It increases the chance of recieving annoying warning messages by firewalls and anti-malware software. If you want to commuicate via Webservices, then you must do this via TLS encrypted communication (and in best case with support of other technologies like HSTS etc.) otherwise all your data is transfered in cleartext. Any other desktop app (or in worst case remote software e.g. proxy) could read/capture/manipulate your desktop-client communication and would threaten the integrity of your data.
@Kristin Green : if you need a highly scalable, secure etc solution then Tomas Jakobs is of course correct. If you need a simple, local network solution then you can use a simpler approach.
The easiest way is probably to create two apps as you suggest, but then communicate between them with Xojo’s built in IPC classes to keep things a bit faster and less race condition prone than using your own local files: https://documentation.xojo.com/api/networking/ipcsocket.html
Alternatively, you could use the Aloe library (https://aloe.zone/) to provide a server directly from your desktop app. It would need to be run on it’s own thread to not interrupt processing of GUI events.
If you do make a web service, use standard security practices and it’s perfectly safe. Lots of very successful software does this, but you have to be careful.
Alternatives:
If you just want your own apps to communicate locally, just stick with IPC.