2016-05-19 12:07:38 +02:00
|
|
|
program jwtplainserver;
|
|
|
|
|
2019-12-01 20:55:31 +01:00
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
|
2016-05-19 12:07:38 +02:00
|
|
|
uses
|
|
|
|
System.SysUtils,
|
|
|
|
Winapi.ShellAPI,
|
|
|
|
Web.WebReq,
|
|
|
|
Web.WebBroker,
|
|
|
|
IdHTTPWebBrokerBridge,
|
|
|
|
MyControllerU in 'MyControllerU.pas',
|
2020-11-27 12:10:46 +01:00
|
|
|
MainWebModuleU in 'MainWebModuleU.pas',
|
|
|
|
MVCFramework.Commons {MyWebModule: TWebModule};
|
2016-05-19 12:07:38 +02:00
|
|
|
|
|
|
|
{$R *.res}
|
|
|
|
|
|
|
|
procedure RunServer(APort: Integer);
|
|
|
|
var
|
|
|
|
LServer: TIdHTTPWebBrokerBridge;
|
|
|
|
begin
|
|
|
|
Writeln('** DMVCFramework Server **');
|
|
|
|
Writeln(Format('Starting HTTP Server on port %d', [APort]));
|
|
|
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
|
|
|
try
|
2020-11-27 12:10:46 +01:00
|
|
|
LServer.OnParseAuthentication :=
|
|
|
|
TMVCParseAuthentication.OnParseAuthentication;
|
2016-05-19 12:07:38 +02:00
|
|
|
LServer.DefaultPort := APort;
|
|
|
|
LServer.Active := True;
|
2019-12-01 20:55:31 +01:00
|
|
|
// ShellExecute(0, 'open', pChar('http://localhost:' + inttostr(APort)), nil, nil, SW_SHOWMAXIMIZED);
|
2020-11-27 12:10:46 +01:00
|
|
|
Writeln('Press RETURN to stop the server');
|
|
|
|
Readln;
|
2016-05-19 12:07:38 +02:00
|
|
|
finally
|
|
|
|
LServer.Free;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
begin
|
|
|
|
ReportMemoryLeaksOnShutdown := 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;
|
2019-12-01 20:55:31 +01:00
|
|
|
|
2016-05-19 12:07:38 +02:00
|
|
|
end.
|