Jump to content

albertovesx

uniGUI Subscriber
  • Posts

    598
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by albertovesx

  1. You can use the "OnHTTPCommand" event in the UniServerModule.

    procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo;
      AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);
    var
      RC : TRESTClient;
    
    begin
      RC := TRESTClient.Create;
      try
        if ARequestInfo.URI='/data/synchronizer' then
        begin
          // DO YOUR REST STUFF
    
          AResponseInfo.ResponseNo := 200;
          AResponseInfo.ContentText := 'Synchronization done!';
          AResponseInfo.WriteContent;
          Handled := True;
        end;
      finally
        RC.Free;
      end;
    end;
    

    You can then call it like this:

     

    ...localhost:8077/data/synchronizer

    Is this UniGUIServerModuleHTTPCommand like having webbroker inside unigui app? Does it creates a thread for each request?

×
×
  • Create New...