Controllers

Business logic coordination between routes and services.

Controllers should:

  • Handle business logic and orchestration between services
  • Handle environment variables and configuration
  • Coordinate multiple service calls
  • Implement business rules and validation
  • Handle service business logic layer (result.success)

Controller Types

Data API Controllers

  • Return data objects for routes to handle HTTP responses
  • Example: glimpseHandler returns data, route calls c.json(result)

Webhook Handler Controllers

  • Handle HTTP requests/responses directly (webhook handler pattern)
  • Example: handleUrlWebhook takes Context, returns HTTP responses
  • Used for /tasks/* webhook endpoints