2017-03-01 21:40:57 +01:00
|
|
|
|
program TestServer;
|
|
|
|
|
|
|
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
System.SysUtils,
|
|
|
|
|
IdHTTPWebBrokerBridge,
|
|
|
|
|
Web.WebReq,
|
2020-05-25 19:34:14 +02:00
|
|
|
|
{$IFNDEF LINUX}
|
2017-04-24 00:19:53 +02:00
|
|
|
|
Winapi.Windows,
|
2020-05-25 19:34:14 +02:00
|
|
|
|
{$ENDIF }
|
2017-03-01 21:40:57 +01:00
|
|
|
|
Web.WebBroker,
|
|
|
|
|
MVCFramework.Commons,
|
2017-10-16 22:57:27 +02:00
|
|
|
|
MVCFramework.Console,
|
2020-05-25 19:34:14 +02:00
|
|
|
|
WebModuleUnit in 'WebModuleUnit.pas' {MainWebModule: TWebModule},
|
2017-03-01 21:40:57 +01:00
|
|
|
|
TestServerControllerU in 'TestServerControllerU.pas',
|
|
|
|
|
TestServerControllerExceptionU in 'TestServerControllerExceptionU.pas',
|
|
|
|
|
SpeedMiddlewareU in 'SpeedMiddlewareU.pas',
|
|
|
|
|
TestServerControllerPrivateU in 'TestServerControllerPrivateU.pas',
|
|
|
|
|
AuthHandlersU in 'AuthHandlersU.pas',
|
2017-06-22 16:18:58 +02:00
|
|
|
|
BusinessObjectsU in '..\..\..\samples\commons\BusinessObjectsU.pas',
|
2017-09-26 01:02:09 +02:00
|
|
|
|
MVCFramework in '..\..\..\sources\MVCFramework.pas',
|
|
|
|
|
TestServerControllerJSONRPCU in 'TestServerControllerJSONRPCU.pas',
|
2018-10-23 16:18:34 +02:00
|
|
|
|
MVCFramework.JSONRPC in '..\..\..\sources\MVCFramework.JSONRPC.pas',
|
2020-09-16 15:56:14 +02:00
|
|
|
|
RandomUtilsU in '..\..\..\samples\commons\RandomUtilsU.pas',
|
2020-11-27 15:13:17 +01:00
|
|
|
|
MVCFramework.Serializer.HTML in '..\..\..\sources\MVCFramework.Serializer.HTML.pas',
|
2022-01-26 23:00:32 +01:00
|
|
|
|
MVCFramework.Tests.Serializer.Entities in '..\..\common\MVCFramework.Tests.Serializer.Entities.pas',
|
2022-08-01 19:11:42 +02:00
|
|
|
|
MVCFramework.Router in '..\..\..\sources\MVCFramework.Router.pas',
|
|
|
|
|
FDConnectionConfigU in '..\..\common\FDConnectionConfigU.pas',
|
|
|
|
|
Entities in '..\Several\Entities.pas',
|
|
|
|
|
EntitiesProcessors in '..\Several\EntitiesProcessors.pas';
|
2017-03-01 21:40:57 +01:00
|
|
|
|
|
|
|
|
|
{$R *.res}
|
|
|
|
|
|
|
|
|
|
procedure Logo;
|
|
|
|
|
begin
|
2020-05-25 15:12:46 +02:00
|
|
|
|
ResetConsole();
|
2020-04-18 23:32:24 +02:00
|
|
|
|
Writeln;
|
2020-11-27 15:13:17 +01:00
|
|
|
|
TextBackground(TConsoleColor.Black);
|
|
|
|
|
TextColor(TConsoleColor.Red);
|
2020-05-25 15:12:46 +02:00
|
|
|
|
Writeln(' ██████╗ ███╗ ███╗██╗ ██╗ ██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗');
|
|
|
|
|
Writeln(' ██╔══██╗████╗ ████║██║ ██║██╔════╝ ██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗');
|
|
|
|
|
Writeln(' ██║ ██║██╔████╔██║██║ ██║██║ ███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝');
|
|
|
|
|
Writeln(' ██║ ██║██║╚██╔╝██║╚██╗ ██╔╝██║ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗');
|
|
|
|
|
Writeln(' ██████╔╝██║ ╚═╝ ██║ ╚████╔╝ ╚██████╗ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║');
|
|
|
|
|
Writeln(' ╚═════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝');
|
|
|
|
|
Writeln(' ');
|
2023-01-28 23:31:00 +01:00
|
|
|
|
TextColor(TConsoleColor.White);
|
2023-01-23 16:19:32 +01:00
|
|
|
|
Write('PLATFORM: ');
|
|
|
|
|
{$IF Defined(Win32)} Writeln('WIN32'); {$ENDIF}
|
|
|
|
|
{$IF Defined(Win64)} Writeln('WIN64'); {$ENDIF}
|
|
|
|
|
{$IF Defined(Linux64)} Writeln('Linux64'); {$ENDIF}
|
2020-11-27 15:13:17 +01:00
|
|
|
|
TextColor(TConsoleColor.Yellow);
|
2020-05-25 15:12:46 +02:00
|
|
|
|
Writeln('DMVCFRAMEWORK VERSION: ', DMVCFRAMEWORK_VERSION);
|
2020-11-27 15:13:17 +01:00
|
|
|
|
TextColor(TConsoleColor.White);
|
2017-03-01 21:40:57 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure RunServer(APort: Integer);
|
|
|
|
|
var
|
|
|
|
|
LServer: TIdHTTPWebBrokerBridge;
|
|
|
|
|
begin
|
|
|
|
|
Logo;
|
2020-05-25 15:12:46 +02:00
|
|
|
|
Writeln(Format('Starting HTTP Server or port %d', [APort]));
|
2017-03-01 21:40:57 +01:00
|
|
|
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
|
|
|
|
try
|
2020-05-25 15:12:46 +02:00
|
|
|
|
LServer.OnParseAuthentication :=
|
|
|
|
|
TMVCParseAuthentication.OnParseAuthentication;
|
2017-03-01 21:40:57 +01:00
|
|
|
|
LServer.DefaultPort := APort;
|
|
|
|
|
LServer.Active := True;
|
|
|
|
|
LServer.MaxConnections := 0;
|
|
|
|
|
LServer.ListenQueue := 200;
|
2020-05-25 15:12:46 +02:00
|
|
|
|
Writeln('Press RETURN to stop the server');
|
2020-05-25 15:18:32 +02:00
|
|
|
|
WaitForReturn;
|
2020-11-27 15:13:17 +01:00
|
|
|
|
TextColor(TConsoleColor.Red);
|
2020-05-25 15:12:46 +02:00
|
|
|
|
Writeln('Server stopped');
|
|
|
|
|
ResetConsole();
|
2017-03-01 21:40:57 +01:00
|
|
|
|
finally
|
|
|
|
|
LServer.Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
ReportMemoryLeaksOnShutdown := True;
|
|
|
|
|
try
|
|
|
|
|
if WebRequestHandler <> nil then
|
|
|
|
|
WebRequestHandler.WebModuleClass := WebModuleClass;
|
|
|
|
|
RunServer(9999);
|
|
|
|
|
except
|
|
|
|
|
on E: Exception do
|
2020-05-25 15:12:46 +02:00
|
|
|
|
Writeln(E.ClassName, ': ', E.Message);
|
2020-05-02 17:06:59 +02:00
|
|
|
|
end;
|
2017-03-01 21:40:57 +01:00
|
|
|
|
|
|
|
|
|
end.
|