Routing
The directory tree under app/routes is the route table.
A file's location determines its path; the procedures it declares determine its kind. Only .chpl files are scanned — there is no template format and no second file type.
| File | Route |
|---|---|
routes/index.chpl | / |
routes/about.chpl | /about |
routes/posts/index.chpl | /posts |
routes/posts/[id].chpl | /posts/[id] |
routes/docs/[...path].chpl | /docs/[...path] |
routes/api/health.chpl | /api/health |
index contributes no segment. There is no distinction between page directories and API directories: /api above is a naming choice, not a convention the framework enforces.
In this section
- File-system routes — literals, index files and route groups
- Dynamic segments —
[id],[...path]and path parameters - API routes — method handlers, request bodies and responses
- Match order — how the router picks a route without backtracking