원클릭으로
horse-minimal-api
Guide for building lightweight, low-boilerplate, and rapid HTTP services (Minimal APIs) in Horse.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Guide for building lightweight, low-boilerplate, and rapid HTTP services (Minimal APIs) in Horse.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | horse-minimal-api |
| description | Guide for building lightweight, low-boilerplate, and rapid HTTP services (Minimal APIs) in Horse. |
For focused microservices, mock APIs, or rapid prototyping, you can leverage Horse's lightweight routing and configuration DSL to build complete HTTP services in a single file with minimal boilerplate.
A Minimal API structures all route registrations, basic logic, and middleware imports directly within the main .dpr bootstrap file using inline anonymous procedures:
program MinimalAPI;
{$APPTYPE CONSOLE}
uses
System.SysUtils,
System.JSON,
Horse,
Horse.Jhonson;
begin
// 1. Fluent Middleware Configuration
THorse.Use(Jhonson);
// 2. Inline Route Mappings
THorse.Get('/ping',
procedure(Req: THorseRequest; Res: THorseResponse)
begin
Res.Send('pong');
end);
THorse.Get('/hello/:name',
procedure(Req: THorseRequest; Res: THorseResponse)
begin
Res.Send('Hello, ' + Req.Params.Field('name').AsString + '!');
end);
// 3. Fast JSON response
THorse.Get('/status',
procedure(Req: THorseRequest; Res: THorseResponse)
var
LStatus: TJSONObject;
begin
LStatus := TJSONObject.Create(TJSONPair.Create('status', 'online'));
Res.Send(LStatus); // Johnson takes ownership
end);
// 4. Port Listening
THorse.Listen(9000);
end.
Although Minimal APIs promote rapid development, follow these principles to avoid "spaghetti code":
THorse.UseRadixRouter; to ensure maximum matching speed if your API contains path parameters.Transition from a Minimal API to a structured MVC/Modular architecture when:
.dpr file.Guidelines and workflows for developing and maintaining regular expressions and optional parameter routing features in the Horse framework.
Guidelines for registering, executing, and optimizing native high-precision telemetry hooks (AddOnTelemetry) in the Horse Web Framework.
Guidelines for instantiating and configuring independent Horse server instances (THorseInstance) running concurrently on different ports.
Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.
Guide for managing request-scoped contextual services and IoC (dependency injection) in Delphi and Lazarus.
Guide to using standard Horse middlewares (CORS, Jhonson, compression, basic-auth, logger) and pipeline registration order.