mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 15:55:54 +01:00
49 lines
1.2 KiB
ObjectPascal
49 lines
1.2 KiB
ObjectPascal
|
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;
|
||
|
|
||
|
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);
|
||
|
|
||
|
// required by the TMVCCacheController
|
||
|
MVC.Config['redis_connection_string'] := '127.0.0.1:6379';
|
||
|
|
||
|
MVC.AddController(TPeopleController);
|
||
|
end;
|
||
|
|
||
|
end.
|