delphimvcframework/samples/server_in_dll/REST/REST.WebModule.pas

50 lines
874 B
ObjectPascal
Raw Normal View History

2019-05-19 14:06:12 +02:00
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.