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/ │ ├── ws.js → WS /api/ws (WebSocket echo, Node.js) │ ├── grpc/ │ │ └── [[method]].go → gRPC-Web /api/grpc/* (Greeter service) │ ├── 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
WebSocket
WS/api/wsdisconnected
WebSocket echo server — Node.js function using the platform WebSocketPair API
cloud-functions/api/ws.js
gRPC-Web
gRPCgreeter.Greeter/SayHello
gRPC-Web unary call — protobuf framing over POST /api/grpc/*, standard library only
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