Rest server – How to

I try to understand how build a Rest server with Xojo, I have very little experience with REST server.
So I am looking for some example on how to do.

I found two framework:

Any help or suggestion is welcome.

Here’s another one for you from Greg O’Lone that you missed.

Here’s a simple one for you. Place this code in the HandleURL event handler in the App class.

Var j As New JSONItem
j.Value("Address") = request.RemoteAddress
response.Status = 200
response.Header("content-type") = "application/json"
Return True

This code simply returns the ip address of the machine making the request to the web application or the ip address of the router if called remotely.

1 Like

Thank you Patrick and Wayne, I will check and try :wink:

Depending on what the web app is doing, I have found that you cannot do big processes here (HandleURL). If you need to process data to send back to a client, have the client connect and request, and have it poll to get the info when the server has it ready, and ready to send without a whole lot of processing (i.e. just grabbing it from a variable and passing it on).

1 Like