mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 16:25:54 +01:00
4e366e5a53
Added overload for Render(TDataSet) Changed default serialization for Render(TDataSet)
47 lines
1016 B
ObjectPascal
47 lines
1016 B
ObjectPascal
program MiddlewareSamples;
|
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
|
|
uses
|
|
System.SysUtils,
|
|
Web.WebReq,
|
|
Web.WebBroker,
|
|
IdHTTPWebBrokerBridge,
|
|
WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule} ,
|
|
AppControllerU in 'AppControllerU.pas',
|
|
MiddlewareSample1 in 'MiddlewareSample1.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;
|
|
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.
|