mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
48 lines
890 B
ObjectPascal
48 lines
890 B
ObjectPascal
unit MainWebModuleUnit;
|
|
|
|
interface
|
|
|
|
uses
|
|
System.SysUtils,
|
|
System.Classes,
|
|
Web.HTTPApp,
|
|
MVCFramework;
|
|
|
|
type
|
|
Twm = class(TWebModule)
|
|
procedure WebModuleCreate(Sender: TObject);
|
|
|
|
private
|
|
MVCEngine: TMVCEngine;
|
|
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
WebModuleClass: TComponentClass = Twm;
|
|
|
|
implementation
|
|
|
|
uses
|
|
WineCellarAppControllerU,
|
|
MVCFramework.Commons,
|
|
MVCFramework.Middleware.StaticFiles,
|
|
System.IOUtils;
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Twm.WebModuleCreate(Sender: TObject);
|
|
begin
|
|
MVCEngine := TMVCEngine.Create(self);
|
|
MVCEngine.AddController(TWineCellarApp);
|
|
MVCEngine.AddMiddleware(TMVCStaticFilesMiddleware.Create(
|
|
'/app', { StaticFilesPath }
|
|
TPath.Combine(AppPath, '..\..\www'), { DocumentRoot }
|
|
'index.html' { IndexDocument - Before it was named fallbackresource }
|
|
));
|
|
end;
|
|
|
|
end.
|