2019-01-08 12:48:27 +01:00
|
|
|
program middleware_analytics;
|
|
|
|
|
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
|
|
|
|
uses
|
|
|
|
System.SysUtils,
|
2022-08-13 00:21:00 +02:00
|
|
|
MVCFramework,
|
2019-01-08 12:48:27 +01:00
|
|
|
MVCFramework.Logger,
|
|
|
|
MVCFramework.Commons,
|
2022-08-13 00:21:00 +02:00
|
|
|
MVCFramework.Signal,
|
2019-01-08 12:48:27 +01:00
|
|
|
MVCFramework.REPLCommandsHandlerU,
|
|
|
|
Web.ReqMulti,
|
|
|
|
Web.WebReq,
|
|
|
|
Web.WebBroker,
|
|
|
|
IdHTTPWebBrokerBridge,
|
|
|
|
MainControllerU in 'MainControllerU.pas',
|
|
|
|
WebModuleU in 'WebModuleU.pas' {MyWebModule: TWebModule},
|
|
|
|
MVCFramework.Middleware.Analytics in '..\..\sources\MVCFramework.Middleware.Analytics.pas';
|
|
|
|
|
|
|
|
{$R *.res}
|
|
|
|
|
|
|
|
procedure RunServer(APort: Integer);
|
|
|
|
var
|
|
|
|
lServer: TIdHTTPWebBrokerBridge;
|
|
|
|
begin
|
|
|
|
Writeln('** DMVCFramework Server ** build ' + DMVCFRAMEWORK_VERSION);
|
|
|
|
|
|
|
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
|
|
|
try
|
|
|
|
LServer.DefaultPort := APort;
|
|
|
|
|
|
|
|
{ more info about MaxConnections
|
|
|
|
http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_MaxConnections.html }
|
|
|
|
LServer.MaxConnections := 0;
|
|
|
|
|
|
|
|
{ more info about ListenQueue
|
|
|
|
http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdCustomTCPServer_ListenQueue.html }
|
|
|
|
LServer.ListenQueue := 200;
|
|
|
|
|
2022-08-13 00:21:00 +02:00
|
|
|
lServer.Active := True;
|
|
|
|
Writeln('Listening on port: ', APort);
|
|
|
|
WriteLn('CTRL+C to shutdown the server');
|
|
|
|
WaitForTerminationSignal;
|
|
|
|
EnterInShutdownState;
|
|
|
|
lServer.Active := False;
|
2019-01-08 12:48:27 +01:00
|
|
|
finally
|
|
|
|
LServer.Free;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
begin
|
|
|
|
ReportMemoryLeaksOnShutdown := True;
|
|
|
|
IsMultiThread := True;
|
|
|
|
try
|
|
|
|
if WebRequestHandler <> nil then
|
|
|
|
WebRequestHandler.WebModuleClass := WebModuleClass;
|
|
|
|
WebRequestHandlerProc.MaxConnections := 1024;
|
|
|
|
RunServer(8080);
|
|
|
|
except
|
|
|
|
on E: Exception do
|
|
|
|
Writeln(E.ClassName, ': ', E.Message);
|
|
|
|
end;
|
|
|
|
end.
|