2023-08-15 18:24:17 +02:00
|
|
|
unit MainControllerU;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
MVCFramework, MVCFramework.Commons, MVCFramework.Serializer.Commons;
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
[MVCPath('/api')]
|
|
|
|
TMyController = class(TMVCController)
|
|
|
|
public
|
|
|
|
[MVCPath('/customers')]
|
|
|
|
[MVCHTTPMethod([httpPOST])]
|
2023-08-15 21:25:46 +02:00
|
|
|
procedure CreateCustomer(const [MVCFromBody] Dict: TMVCStringDictionary);
|
2023-08-15 18:24:17 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
System.SysUtils, MVCFramework.Logger, System.StrUtils;
|
|
|
|
|
2023-08-15 21:25:46 +02:00
|
|
|
procedure TMyController.CreateCustomer(const [MVCFromBody] Dict: TMVCStringDictionary);
|
2023-08-15 18:24:17 +02:00
|
|
|
begin
|
2023-08-15 21:25:46 +02:00
|
|
|
Render(
|
|
|
|
ObjectDict().Add('data', StrDict.Add('message', Dict['hello']))
|
|
|
|
)
|
2023-08-15 18:24:17 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|