mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 00:05:53 +01:00
31 lines
598 B
ObjectPascal
31 lines
598 B
ObjectPascal
unit MainControllerU;
|
|
|
|
interface
|
|
|
|
uses
|
|
MVCFramework, MVCFramework.Commons, MVCFramework.Serializer.Commons;
|
|
|
|
type
|
|
|
|
[MVCPath('/api')]
|
|
TMyController = class(TMVCController)
|
|
public
|
|
[MVCPath('/customers')]
|
|
[MVCHTTPMethod([httpPOST])]
|
|
procedure CreateCustomer(const [MVCFromBody] Dict: TMVCStringDictionary);
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
System.SysUtils, MVCFramework.Logger, System.StrUtils;
|
|
|
|
procedure TMyController.CreateCustomer(const [MVCFromBody] Dict: TMVCStringDictionary);
|
|
begin
|
|
Render(
|
|
ObjectDict().Add('data', StrDict.Add('message', Dict['hello']))
|
|
)
|
|
end;
|
|
|
|
end.
|