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

JSONBr-Horse

JSONBr Middleware for Horse

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

JSONBr Middleware for Horse

HorseJsonBr is a middleware created by Isaque Pinheiro to work with JSON in APIs developed with the Horse framework.

We created a channel on Telegram for questions and support:

⚙️ Installation

Installation is done using the boss install command:

bash
boss install github.com/isaquepinheiro/horse-jsonbr

If you choose to install manually, simply add the following folders to your project, in Project > Options > Resource Compiler > Directories and Conditionals > Include file search path

pascal
../JSONBr-Horse/src

✔️ Compatibility

This middleware is compatible with projects developed in:

  • [X] Delphi

⚡️ Quickstart Delphi

delphi
uses 
  Horse, 
  Horse.JsonBr;

type
  TMyClass = class
  private
    FName: String;
  public
    property Name: String read FName write FName;
  end;

begin
  THorse.Use(HorseJsonBr);

  THorse.Get('/ping',
    procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
    var
      LObj: TMyClass;
    begin
      LObj := TMyClass.Create;
      LObj.Name := 'JSONBr Middleware for Horse';
      Res.Send<TMyClass>(LObj);
    end);

  THorse.Listen(9000,
    procedure(Horse: THorse)
    begin
      Writeln('Servidor Rodando...');
    end);
end.

⚠️ License

HorseJsonBr is free and open-source middleware licensed under the MIT License.