delphimvcframework/samples/outputcachewithredis/WebModuleU.pas

51 lines
1.2 KiB
ObjectPascal
Raw Normal View History

unit WebModuleU;
interface
uses System.SysUtils, System.Classes, Web.HTTPApp, MVCFramework, FireDAC.Stan.Intf,
FireDAC.Stan.Option,
FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool,
FireDAC.Stan.Async,
FireDAC.Phys, Data.DB, FireDAC.Comp.Client;
type
TwmMain = class(TWebModule)
procedure WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure WebModuleCreate(Sender: TObject);
private
MVC: TMVCEngine;
public
{ Public declarations }
end;
var
WebModuleClass: TComponentClass = TwmMain;
implementation
{$R *.dfm}
uses PeopleControllerU, MVCFramework.Commons;
procedure TwmMain.WebModule1DefaultHandlerAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := '<html><heading/><body>Web Server Application</body></html>';
end;
procedure TwmMain.WebModuleCreate(Sender: TObject);
begin
MVC := TMVCEngine.Create(Self,
procedure(Config: TMVCConfig)
begin
// required by the TMVCCacheController
MVC.Config['redis_connection_string'] := '127.0.0.1:6379';
end);
MVC.AddController(TPeopleController);
end;
end.