delphimvcframework/samples/winecellarserver/MainWebModuleUnit.pas

48 lines
890 B
ObjectPascal
Raw Normal View History

2013-10-29 16:51:16 +01:00
unit MainWebModuleUnit;
interface
uses
System.SysUtils,
System.Classes,
Web.HTTPApp,
MVCFramework;
2013-10-29 16:51:16 +01:00
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;
2013-10-29 16:51:16 +01:00
{$R *.dfm}
2013-10-29 16:51:16 +01:00
procedure Twm.WebModuleCreate(Sender: TObject);
begin
MVCEngine := TMVCEngine.Create(self);
MVCEngine.AddController(TWineCellarApp);
MVCEngine.AddMiddleware(TMVCStaticFilesMiddleware.Create(
2020-09-16 20:44:20 +02:00
'/app', { StaticFilesPath }
TPath.Combine(AppPath, '..\..\www'), { DocumentRoot }
'index.html' { IndexDocument - Before it was named fallbackresource }
));
2013-10-29 16:51:16 +01:00
end;
end.