Python + EdgeOne Pages

File-based routing for Python functions. Each .py file in cloud-functions/ automatically maps to an HTTP endpoint.

File-Based Routing Structure

cloud-functions/
├── hello.py                              → GET /hello
├── api/
│   ├── posts/
│   │   └── index.py                      → GET /api/posts
│   ├── users/
│   │   ├── [userId].py                   → GET /api/users/:userId
│   │   └── [userId]/
│   │       └── posts/
│   │           └── [postId].py           → GET /api/users/:userId/posts/:postId
│   └── files/
│       └── [[path]].py                   → GET /api/files/*path (catch-all)

Static Routes

GET/hello

Static route — file name maps directly to path

Index Routes

GET/api/posts

index.py 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

Pure Python

No framework overhead, standard BaseHTTPRequestHandler