• Decorator for GET endpoints

    Parameters

    • path: string

      The route path (e.g., "/api/users/:id")

      Supports PropKeys for dynamic path segments:

      • {MODEL_ID} - replaced with the model's ID
      • {PROP_propertyName} - replaced with model.propertyName value

    Returns ((target, propertyKey, descriptor) => PropertyDescriptor)

      • (target, propertyKey, descriptor): PropertyDescriptor
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns PropertyDescriptor

    Example: Basic usage:

    @get("/api/users/:id")
    async getUser(req: KosRequest<"/api/users/:id">, res: KosResponse) {
    const userId = req.params.id;
    const user = await this.userService.getUser(userId);
    res.status(200).send(user);
    }

    Example: With PropKeys:

    class TenantApiModel {
    tenantId = "acme-corp";

    @get("/api/tenants/{PROP_tenantId}/users")
    async getTenantUsers(req: KosRequest, res: KosResponse) {
    // Route registered as: /api/tenants/acme-corp/users
    }

    @get("/api/models/{MODEL_ID}/config")
    async getModelConfig(req: KosRequest, res: KosResponse) {
    // Route registered as: /api/models/<actual-model-id>/config
    }
    }