Go + EdgeOne Pages
File-based routing for Go functions. Each .go file in cloud-functions/ automatically maps to an HTTP endpoint.
File-Based Routing Structure
cloud-functions/ ├── hello.go → GET /hello ├── api/ │ ├── posts/ │ │ └── index.go → GET /api/posts │ ├── users/ │ │ ├── [userId].go → GET /api/users/:userId │ │ └── [userId]/ │ │ └── posts/ │ │ └── [postId].go → GET /api/users/:userId/posts/:postId │ └── files/ │ └── [[path]].go → GET /api/files/*path (catch-all)
Static Routes
GET/hello
Static route — file name maps directly to path
Index Routes
GET/api/posts
index.go serves as the default handler for a directory
Single Dynamic Param [param]
GET/api/users/u-42
[userId] captures a single dynamic segment
Multiple Dynamic Params
GET/api/users/u-42/posts/p-7
Nested dynamic params: [userId] and [postId]
Catch-All Routes [[param]]
GET/api/files/docs/guide/intro.md
[[path]] catches all remaining path segments
File-Based Routing
Intuitive routing based on file system structure
Dynamic Routes
Support for params, nested params, and catch-all
Go Performance
Native Go compilation for maximum efficiency