mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 16:25:54 +01:00
50 lines
874 B
ObjectPascal
50 lines
874 B
ObjectPascal
|
unit REST.WebModule;
|
||
|
|
||
|
interface
|
||
|
|
||
|
uses
|
||
|
System.SysUtils,
|
||
|
System.Classes,
|
||
|
Web.HTTPApp,
|
||
|
MVCFramework,
|
||
|
MVCFramework.Middleware.CORS,
|
||
|
MVCFramework.Middleware.Compression;
|
||
|
|
||
|
type
|
||
|
TMainWebModule = class(TWebModule)
|
||
|
procedure DataModuleCreate(Sender: TObject);
|
||
|
procedure DataModuleDestroy(Sender: TObject);
|
||
|
private
|
||
|
fEngine: TMVCEngine;
|
||
|
public
|
||
|
{ Public declarations }
|
||
|
end;
|
||
|
|
||
|
var
|
||
|
WebModuleClass: TComponentClass = TMainWebModule;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
uses
|
||
|
System.IOUtils,
|
||
|
MVCFramework.Commons,
|
||
|
REST.MainController,
|
||
|
MVCFramework.Middleware.Authentication;
|
||
|
|
||
|
{ %CLASSGROUP 'Vcl.Controls.TControl' }
|
||
|
|
||
|
{$R *.dfm}
|
||
|
|
||
|
|
||
|
procedure TMainWebModule.DataModuleCreate(Sender: TObject);
|
||
|
begin
|
||
|
fEngine := TMVCEngine.Create(self).AddController(TMainController);
|
||
|
end;
|
||
|
|
||
|
procedure TMainWebModule.DataModuleDestroy(Sender: TObject);
|
||
|
begin
|
||
|
fEngine.Free;
|
||
|
end;
|
||
|
|
||
|
end.
|