delphimvcframework/samples/middleware_activerecord/MainControllerU.pas
Daniele Teti f54f74522c - Default error responses contains the official "reason string" associated to the HTTP status code (this can be a breaking change for some generic client which doesn't correctly interpret the http status code)
- Added static method `HTTP_STATUS.ReasonStringFor(HTTPStatusCode)` wich returns the standard `ReasonString` for a given HTTP status code.
- Improved handling of `TMVCErrorResponse` information
- mid-air-collision handling now uses SHA1 instead of MD5
- Added `MVCFramework.Commons.MVC_HTTP_STATUS_CODES` const array containing all the HTTP status codes wich its `ReasonString`
2022-10-09 15:45:59 +02:00

36 lines
658 B
ObjectPascal

unit MainControllerU;
interface
uses
MVCFramework, MVCFramework.Commons, MVCFramework.Serializer.Commons;
type
[MVCPath('/api')]
TMyController = class(TMVCController)
public
[MVCPath]
[MVCHTTPMethod([httpGET])]
procedure Index;
end;
implementation
uses
MVCFramework.ActiveRecord,
MVCFramework.SQLGenerators.PostgreSQL,
System.SysUtils,
MVCFramework.Logger,
System.StrUtils,
Entities;
procedure TMyController.Index;
begin
Render(ObjectDict().Add('people',
//TMVCActiveRecord.SelectRQL<TPerson>('and(gt(id, 2),lt(id,6))', 100)
TMVCActiveRecord.SelectRQL<TPerson>('sort(+personSurname)', 10)
));
end;
end.