원클릭으로
horse-routing
Guidelines for setting up endpoints, defining path parameters, route wildcards, and structuring HTTP controllers.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Guidelines for setting up endpoints, defining path parameters, route wildcards, and structuring HTTP controllers.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | horse-routing |
| description | Guidelines for setting up endpoints, defining path parameters, route wildcards, and structuring HTTP controllers. |
Horse supports registering endpoints for all standard HTTP verbs using static or instance methods:
THorse.Get('/products', GetProductsHandler);
THorse.Post('/products', CreateProductHandler);
THorse.Put('/products', UpdateProductHandler);
THorse.Delete('/products', DeleteProductHandler);
THorse.Patch('/products', PatchProductHandler);
Path parameters are defined using the colon syntax (:param):
THorse.Get('/users/:id', GetUserHandler);THorse.Get('/users/{id}', GetUserHandler);Inside the handler, you access the parameter via Req.Params.Items['id'] (or Req.Params['id']).
Use the wildcard asterisk (*) to match any subpath:
// Matches /public/css/site.css, /public/images/logo.png, etc.
THorse.Get('/public/*', ServeStaticFilesHandler);
You can group related routes under a common path prefix using THorse.Group. This is highly useful for API versioning (e.g., /v1) and isolating group-level middlewares:
Prefixing Routes:
THorse.Group.Prefix('/v1')
.Get('/products', GetProductsHandler)
.Get('/customers', GetCustomersHandler);
Group-level Middlewares (Restricted Middlewares):
Instead of registering a middleware globally via THorse.Use, you can register it specifically for a group using .Use(). The middleware will only run for endpoints defined inside that group:
THorse.Group.Prefix('/admin')
.Use(AuthMiddleware) // Only runs for routes under /admin
.Get('/dashboard', GetDashboardHandler)
.Get('/settings', GetSettingsHandler);
You can pass an array of route-specific middlewares (array of THorseCallback) to apply checks only to a single endpoint. These run after global and group-level middlewares:
Static routing:
THorse.Get('/admin/dashboard', [AuthMiddleware, LoggerMiddleware], GetDashboardHandler);
Fluent routing:
THorse.Route('/reports')
.Get([AuthMiddleware, LoggerMiddleware], GetReportsHandler)
.Post([AuthMiddleware], CreateReportHandler);
To keep routes organized, group them logically within static class methods or dedicated units:
type
TUserController = class
public
class procedure RegisterRoutes;
class procedure ListUsers(Req: THorseRequest; Res: THorseResponse; Next: TProc);
end;
class procedure TUserController.RegisterRoutes;
begin
THorse.Get('/users', ListUsers);
end;
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.