'Handler class
Sub Class_Globals
End Sub
Public Sub Initialize
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
Dim sf As Object = GetApiResponse("https://www.boredapi.com/api/activity")
Wait For (sf) Complete (ApiResult As String)
resp.write (ApiResult)
End Sub
Private Sub GetApiResponse (url As String) As ResumableSub
Try
Dim result As String
Dim j As HttpJob
j.Initialize("", Me)
j.Download(url)
Wait For (j) JobDone (j As HttpJob)
If j.Success Then
result = j.GetString
Else
Log(j.ErrorMessage)
End If
j.Release
Catch
Log(LastException)
End Try
Return result
End Sub