Horse and ModularBr

Simplifying the usage of ModularBr with the Horse Framework through middleware.

ModularBr is a framework that provides various functionalities to facilitate the development of applications in Delphi, including dependency injection and bind exporting. Furthermore, ModularBr is compatible with different platforms and frameworks, such as Horse, which is a framework for building RESTful APIs.

To further simplify the integration between ModularBr and Horse, a specific middleware has been developed for this purpose. This middleware automates the calls to ModularBr routes, making the usage of the framework with Horse even simpler and more intuitive.

With this middleware, developers can focus on the application's business logic, letting ModularBr handle dependency injection and bind exporting, while Horse takes care of processing HTTP requests and responses. This speeds up the development process and improves efficiency, allowing the application to be delivered more quickly and at a lower cost.

In summary, the middleware developed for ModularBr and Horse is a solution that simplifies the usage of these tools together, making the development process of Delphi applications faster, more efficient, and more intuitive. With this feature, it is possible to create robust and high-quality applications with greater ease and less effort.

procedure TFormServer.Start;
begin
  // Registering with AppModule
  THorse.Use(HorseModular(TAppModule.Create));

  THorse.Get('/nfe/:id',
    procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
    begin
      Sleep(1000);
      Res.Send('Through Modular, ' + Modular.Get<TControllerServer>.Hello)
         .Status(200)
         .ContentType('application/json');
    end);
  THorse.Listen(StrToInt(PortNumberEdit.Text));
end;

Last updated