# Route groups

Every route belongs to a route group: a `routes` declaration with a name
and a `prefix:`. Each group has a file of its own in its domain's `routes/`
folder.

```jadpo
// domains/planning/routes/todos.jadpo
routes Todos {
    prefix: /todos

    GET / { ... }
    POST / { ... }
    GET /{todo_id: Todo.id} { ... }
    PATCH /{todo_id: Todo.id} { ... }
}
```

The prefix comes before every route's own path, so
`GET /{todo_id: Todo.id}` here answers `GET /todos/{todo_id}`.

The file is named after the prefix's fixed segments, joined with `_`:
`/todos` is `todos.jadpo`, and `/admin/orders` is `admin_orders.jadpo`.

A prefix may hold typed placeholders, which every route in the group can
use: `prefix: /projects/{project_id: Project.id}/todos` lives in
`projects_todos.jadpo`. Two prefixes may start the same way, but the
compiler checks that every URL matches exactly one group, so a URL from a
log leads to one file.

A route is written `GET /path { }`, keyed by its method and path, which is
how HTTP, OpenAPI and logs name a route. Everywhere else, a declaration's
items are written `name: value`; a route entry is the one exception.

Routes are never `public`, the word that lets another domain use a
declaration. Who may call a route is decided by sign-in
([Routes: signed in by default](routes-signed-in-by-default.md))
and by [policy](policy.md).

To see a route's full method and path, hover over it in the editor.
`jadpo routes` lists every route with its full path, file, API,
authentication and the query or action it runs.
