mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 16:25:54 +01:00
60 lines
1.2 KiB
ObjectPascal
60 lines
1.2 KiB
ObjectPascal
|
program ServerSideViewsLua;
|
||
|
|
||
|
{$APPTYPE CONSOLE}
|
||
|
|
||
|
|
||
|
uses
|
||
|
System.SysUtils,
|
||
|
{$IFDEF MSWINDOWS}
|
||
|
Winapi.ShellAPI,
|
||
|
Winapi.Windows,
|
||
|
{$ENDIF }
|
||
|
IdHTTPWebBrokerBridge,
|
||
|
Web.WebReq,
|
||
|
Web.WebBroker,
|
||
|
WebModuleU in 'WebModuleU.pas' {WebModule1: TWebModule},
|
||
|
WebSiteControllerU in 'WebSiteControllerU.pas',
|
||
|
DAL in 'DAL.pas',
|
||
|
MyDataModuleU in '..\renders\MyDataModuleU.pas' {MyDataModule: TDataModule},
|
||
|
MVCFramework.View.Renderers.Lua in 'MVCFramework.View.Renderers.Lua.pas';
|
||
|
|
||
|
{$R *.res}
|
||
|
|
||
|
|
||
|
procedure RunServer(APort: Integer);
|
||
|
var
|
||
|
LServer: TIdHTTPWebBrokerBridge;
|
||
|
begin
|
||
|
ReportMemoryLeaksOnShutdown := True;
|
||
|
Writeln(Format('Starting HTTP Server on port %d', [APort]));
|
||
|
LServer := TIdHTTPWebBrokerBridge.Create(nil);
|
||
|
try
|
||
|
LServer.DefaultPort := APort;
|
||
|
LServer.Active := True;
|
||
|
Writeln('Press RETURN to stop the server');
|
||
|
|
||
|
{$IFDEF MSWINDOWS}
|
||
|
|
||
|
ShellExecute(0, 'open', 'http://localhost:8080', nil, nil, SW_SHOW);
|
||
|
|
||
|
{$ENDIF}
|
||
|
|
||
|
ReadLn;
|
||
|
finally
|
||
|
LServer.Free;
|
||
|
end;
|
||
|
end;
|
||
|
|
||
|
begin
|
||
|
ReportMemoryLeaksOnShutdown := True;
|
||
|
try
|
||
|
if WebRequestHandler <> nil then
|
||
|
WebRequestHandler.WebModuleClass := WebModuleClass;
|
||
|
RunServer(8080);
|
||
|
except
|
||
|
on E: Exception do
|
||
|
Writeln(E.ClassName, ': ', E.Message);
|
||
|
end;
|
||
|
|
||
|
end.
|