Skip to content

Controllers

Controllers define your API endpoints. You can use JSON or TypeScript to describe routes and handlers.

Example (JSON)

json
{
  "name": "TodosController",
  "routes": {
    "GET /todos": "findAll",
    "POST /todos": "create"
  }
}

Example (TypeScript)

ts
// controller/todos.controller.ts
export class TodosController {
  async findAll(ctx) { /* ... */ }
  async create(ctx) { /* ... */ }
}

Features

  • RESTful routes
  • Request validation
  • Hooks & middleware support

See Hooks and Middleware.