2015-06-15 18:57:46 +02:00
|
|
|
unit WebModuleUnit1;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
2016-06-16 22:13:35 +02:00
|
|
|
uses
|
|
|
|
System.SysUtils,
|
2015-06-15 18:57:46 +02:00
|
|
|
System.Classes,
|
|
|
|
Web.HTTPApp,
|
|
|
|
MVCFramework;
|
|
|
|
|
|
|
|
type
|
2016-06-16 22:13:35 +02:00
|
|
|
|
2015-06-15 18:57:46 +02:00
|
|
|
TWebModule1 = class(TWebModule)
|
|
|
|
procedure WebModuleCreate(Sender: TObject);
|
|
|
|
procedure WebModuleDestroy(Sender: TObject);
|
|
|
|
private
|
2016-06-16 22:13:35 +02:00
|
|
|
FMVCEngine: TMVCEngine;
|
2015-06-15 18:57:46 +02:00
|
|
|
public
|
|
|
|
{ Public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
WebModuleClass: TComponentClass = TWebModule1;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
2020-05-11 23:39:43 +02:00
|
|
|
|
2016-06-16 22:13:35 +02:00
|
|
|
uses
|
2020-04-29 01:59:41 +02:00
|
|
|
App1MainControllerU,
|
2020-05-11 23:39:43 +02:00
|
|
|
MVCFramework.Middleware.StaticFiles, MVCFramework.Commons;
|
2015-06-15 18:57:46 +02:00
|
|
|
|
|
|
|
procedure TWebModule1.WebModuleCreate(Sender: TObject);
|
|
|
|
begin
|
2020-05-11 23:39:43 +02:00
|
|
|
FMVCEngine := TMVCEngine.Create(Self,
|
|
|
|
procedure(Config: TMVCConfig)
|
|
|
|
begin
|
|
|
|
Config['view_path'] := '..\Debug\HTML5Application';
|
|
|
|
end);
|
|
|
|
FMVCEngine.AddController(
|
|
|
|
TApp1MainController);
|
2020-04-29 01:59:41 +02:00
|
|
|
FMVCEngine.AddMiddleware(TMVCStaticFilesMiddleware.Create(
|
|
|
|
'/', { StaticFilesPath }
|
|
|
|
'HTML5Application\public_html', { DocumentRoot }
|
2020-05-11 23:39:43 +02:00
|
|
|
'index.html' { IndexDocument - Before it was named fallbackresource }
|
2020-04-29 01:59:41 +02:00
|
|
|
));
|
2015-06-15 18:57:46 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TWebModule1.WebModuleDestroy(Sender: TObject);
|
|
|
|
begin
|
2016-06-16 22:13:35 +02:00
|
|
|
FMVCEngine.free;
|
2015-06-15 18:57:46 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|