delphimvcframework/samples/authenticationauthorization/AuthenticateAuthorize.dpr

54 lines
1.3 KiB
ObjectPascal
Raw Normal View History

2015-04-01 17:01:23 +02:00
program AuthenticateAuthorize;
{$APPTYPE CONSOLE}
uses
System.SysUtils,
2017-05-09 23:13:51 +02:00
{$IFDEF MSWINDOWS}
2015-04-01 17:01:23 +02:00
Winapi.Windows,
Winapi.ShellAPI,
2017-05-09 23:13:51 +02:00
{$ENDIF}
2015-04-01 17:01:23 +02:00
Web.WebReq,
Web.WebBroker,
IdHTTPWebBrokerBridge,
WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule} ,
AppControllerU in 'AppControllerU.pas',
MVCFramework.Middleware.Authentication
in '..\..\sources\MVCFramework.Middleware.Authentication.pas',
AuthenticationU in 'AuthenticationU.pas';
{$R *.res}
procedure RunServer(APort: Integer);
var
LServer: TIdHTTPWebBrokerBridge;
begin
Writeln(Format('Starting HTTP Server or port %d', [APort]));
LServer := TIdHTTPWebBrokerBridge.Create(nil);
try
LServer.DefaultPort := APort;
LServer.Active := True;
2017-05-09 23:13:51 +02:00
Writeln('Press RETURN to stop the server');
{$IFDEF MSWINDOWS}
2020-10-22 09:32:10 +02:00
ShellExecute(0, 'open', PChar('http://localhost:' + IntToStr(APort) + '/static'), nil, nil, SW_SHOW);
2017-05-09 23:13:51 +02:00
{$ENDIF}
ReadLn;
2015-04-01 17:01:23 +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
end.