Here are a few screenshots to give you a sense of how FMLuna works and what it looks like.
Click on a screenshot for a larger version.
Here's an example of a Xojo project that uses Luna.
All of the API's complexity is handled by the Luna class.
To implement an API, you only need to specify your database connection info,
and code up your endpoints as methods of the App class.
This screenshot shows a Xojo method for an endpoint that handles GET requests for a Contacts table.
Here's an example of an API request and response.
In this example, I'm using the amazing
Paw REST client
to submit a GET request for multiple records in a Contacts table.
Notice the simple JSON-encoded response.
Here's another example of an API request and response.
This request was for a specific record in the Contacts table.
Here's an example of a POST request to add a new record.
The request has been made using a JSON-encoded body,
and FMLuna has returned a JSON-encoded response representing the new record.
Calls for updating records (via PATCH requests) are handled in a similar fashion.
Here's an example custom request and response.
If you are familiar with XML Custom Web Publishing, you can easily create
endpoints for a wide variety of purposes, such as getting a list of scripts or layouts from
the database, executing a script, and so on.
This endpoint returns a list of scripts in the database.