Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

HorseGenerics

Publish an [GET PUT POST DELETE] API easily to a list of <T> classes using generics and Horse

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

Horse Generics

Publishes an [GET PUT POST DELETE] API easily to a list of <T> classes using generics and Horse

Motivation

With basic infrastructure of HORSE {AUTHENTICATION} {JSON} {EXCEPTION} Create a new endpoint with one line of code for a model = Class <T>

How it works

Use Generic Controller TApiController<T> to create [GET PUT POST DELETE] routes in your API

delphi
class function Dominios.Publish: String;

begin
  TApiController<TConsulta>.Publicar('/consulta');
  TApiController<TMedicao>.Publicar('/medicao');
end;

It returns

bash
GET /consulta/
GET /consulta/:codigo
POST /consulta/
PUT /consulta/:codigo
DELETE /consulta/:codigo

Requires

Horse https://github.com/HashLoad/horse

Dataset.Serialize https://github.com/viniciussanchez/dataset-serialize

Ricardo Rocha pinned projects https://github.com/ricardodarocha/

https://github.com/ricardodarocha/RttiInterceptor

https://github.com/ricardodarocha/EntityMapper

https://github.com/ricardodarocha/SqlExtrator