2017-05-25 10:31:24 +02:00
|
|
|
|
// ***************************************************************************
|
2017-05-18 00:02:22 +02:00
|
|
|
|
//
|
|
|
|
|
// Delphi MVC Framework
|
|
|
|
|
//
|
2021-08-15 18:39:55 +02:00
|
|
|
|
// Copyright (c) 2010-2021 Daniele Teti and the DMVCFramework Team
|
2017-05-18 00:02:22 +02:00
|
|
|
|
//
|
|
|
|
|
// https://github.com/danieleteti/delphimvcframework
|
|
|
|
|
//
|
|
|
|
|
// Collaborators with this file: Ezequiel Juliano Müller (ezequieljuliano@gmail.com)
|
|
|
|
|
//
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
//
|
|
|
|
|
// ***************************************************************************
|
|
|
|
|
|
2013-11-10 01:03:53 +01:00
|
|
|
|
program renders;
|
2017-04-20 23:48:50 +02:00
|
|
|
|
|
2013-11-10 01:03:53 +01:00
|
|
|
|
{$APPTYPE CONSOLE}
|
|
|
|
|
|
2019-03-10 16:29:18 +01:00
|
|
|
|
|
2013-11-10 01:03:53 +01:00
|
|
|
|
uses
|
|
|
|
|
System.SysUtils,
|
|
|
|
|
IdHTTPWebBrokerBridge,
|
2017-03-29 23:13:20 +02:00
|
|
|
|
MVCFramework.Commons,
|
2013-11-10 01:03:53 +01:00
|
|
|
|
Web.WebReq,
|
|
|
|
|
Web.WebBroker,
|
2017-10-30 14:42:15 +01:00
|
|
|
|
MVCFramework.Console,
|
2019-11-05 14:40:39 +01:00
|
|
|
|
WebModuleU in 'WebModuleU.pas' {WebModule1: TWebModule},
|
2013-11-10 01:03:53 +01:00
|
|
|
|
RenderSampleControllerU in 'RenderSampleControllerU.pas',
|
2016-11-27 23:17:20 +01:00
|
|
|
|
BusinessObjectsU in '..\commons\BusinessObjectsU.pas',
|
2019-11-05 14:40:39 +01:00
|
|
|
|
MyDataModuleU in 'MyDataModuleU.pas' {MyDataModule: TDataModule},
|
2017-05-18 00:02:22 +02:00
|
|
|
|
CustomTypesU in 'CustomTypesU.pas',
|
2017-05-25 10:31:24 +02:00
|
|
|
|
CustomTypesSerializersU in 'CustomTypesSerializersU.pas',
|
2018-07-16 12:34:07 +02:00
|
|
|
|
InMemoryDataU in 'InMemoryDataU.pas',
|
2018-10-23 16:18:34 +02:00
|
|
|
|
MVCFramework.DataSet.Utils in '..\..\sources\MVCFramework.DataSet.Utils.pas',
|
2019-06-25 17:32:30 +02:00
|
|
|
|
RandomUtilsU in '..\commons\RandomUtilsU.pas',
|
2019-11-05 14:40:39 +01:00
|
|
|
|
MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes in '..\..\sources\MVCFramework.Serializer.JsonDataObjects.OptionalCustomTypes.pas',
|
|
|
|
|
MVCFramework.Serializer.JsonDataObjects.CustomTypes in '..\..\sources\MVCFramework.Serializer.JsonDataObjects.CustomTypes.pas';
|
2013-11-10 01:03:53 +01:00
|
|
|
|
|
|
|
|
|
{$R *.res}
|
|
|
|
|
|
2019-03-10 16:29:18 +01:00
|
|
|
|
|
2013-11-10 01:03:53 +01:00
|
|
|
|
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-10-30 14:42:15 +01:00
|
|
|
|
TextColor(Red);
|
2017-03-29 23:13:20 +02:00
|
|
|
|
Writeln('DMVCFRAMEWORK VERSION: ', DMVCFRAMEWORK_VERSION);
|
2017-10-30 14:42:15 +01:00
|
|
|
|
ResetConsole;
|
2017-04-20 23:48:50 +02:00
|
|
|
|
Writeln('Press RETURN to stop the server');
|
2020-05-27 11:28:22 +02:00
|
|
|
|
WaitForReturn;
|
2017-04-20 23:48:50 +02:00
|
|
|
|
Writeln('Stopping...');
|
2013-11-10 01:03:53 +01:00
|
|
|
|
finally
|
|
|
|
|
LServer.Free;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
begin
|
2016-11-27 23:17:20 +01:00
|
|
|
|
ReportMemoryLeaksOnShutdown := True;
|
2013-11-10 01:03:53 +01:00
|
|
|
|
try
|
|
|
|
|
if WebRequestHandler <> nil then
|
|
|
|
|
WebRequestHandler.WebModuleClass := WebModuleClass;
|
|
|
|
|
RunServer(8080);
|
|
|
|
|
except
|
|
|
|
|
on E: Exception do
|
|
|
|
|
Writeln(E.ClassName, ': ', E.Message);
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end.
|