Move from one fetch file to without adding binding noise
The first route-tree step should only change project shape: config, request-wide middleware, one route, and one worker-level test.
Do this before adding storage or remote services. It teaches the authored file shape and the route dispatch contract while the app is still small enough to debug by sight.
- Best for
- The first growth step after
- Files
- , , ,
- Proof
- exercises route dispatch
Copy the route tree shape
Worker-only route tree with one test
These files are enough to move out of a single fetch handler while keeping the runtime and test story honest.
import { defineConfig } from 'devflare/config'
export default defineConfig({
name: 'notes-api',
compatibilityDate: '2026-03-17',
files: {
fetch: 'src/fetch.ts',
routes: {
dir: 'src/routes',
prefix: '/api'
}
}
})
Common failure messages
| Symptom | Likely fix |
|---|---|
| for a route file | Check , the route filename, and any configured prefix. |
| Ambiguous two-argument handler error | Wrap the handler with or use an event-first signature. |
| is not a function | Import from in tests, not from . |
Previous
Your first unit test
Take the same starter worker from the previous page and add one request test through so the first check uses the same runtime shape the worker will actually run.
Next
Your first bindings
Take the same starter worker, split it into routes and helpers, then add one binding-backed route at a time so can stay small.