delphimvcframework/samples/jsonwebtokenplain/jwtplainserver.dpr

50 lines
1.2 KiB
ObjectPascal

program jwtplainserver;
{$APPTYPE CONSOLE}
uses
System.SysUtils,
Winapi.ShellAPI,
Web.WebReq,
Web.WebBroker,
IdHTTPWebBrokerBridge,
MyControllerU in 'MyControllerU.pas',
MainWebModuleU in 'MainWebModuleU.pas',
MVCFramework.Commons {MyWebModule: TWebModule};
{$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
LServer.OnParseAuthentication :=
TMVCParseAuthentication.OnParseAuthentication;
LServer.DefaultPort := APort;
LServer.Active := True;
// ShellExecute(0, 'open', pChar('http://localhost:' + inttostr(APort)), nil, nil, SW_SHOWMAXIMIZED);
Writeln('Press RETURN to stop the server');
Readln;
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.