Created
January 10, 2023 08:35
-
-
Save delphiapp/4450f7a1686bbf5d735432fcb4825e11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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