Skip to content

Instantly share code, notes, and snippets.

@delphiapp
Created January 10, 2023 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delphiapp/4450f7a1686bbf5d735432fcb4825e11 to your computer and use it in GitHub Desktop.
Save delphiapp/4450f7a1686bbf5d735432fcb4825e11 to your computer and use it in GitHub Desktop.
program pHTTPServer;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
{$APPTYPE CONSOLE}
{$DEFINE VER2}//switch to another version
uses
Forms, SysUtils, Windows
{$IFDEF FPC}
,Interfaces
{$ENDIF}
{$IFDEF VER2}
,mormot.rest.http.server
{$ELSE}
,mORMotHttpServer
{$ENDIF}
;
var fHTTPServer : TSQLHttpServer;
const PORT='9999';
begin
try
fHTTPServer:=TSQLHttpServer.Create(PORT,[]);
try
fHTTPServer.AccessControlAllowOrigin:='*';
finally
fHTTPServer.Free;
end;
except
on E:Exception do Application.MessageBox(PChar(E.Message),PChar(Application.Title), MB_OK + MB_ICONSTOP +MB_DEFBUTTON2);
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment