Loading...
Loading...
Compare original and translation side by side
edgeone-pages-deploymiddleware.jsedgeone-pages-deploymiddleware.jsfspathcryptocloud-functions/.js.ts.go.pyResponseres.send()[[default]].jshttp.HandlerFuncclass handler(BaseHTTPRequestHandler)app = Flask(...)app = FastAPI(...).pyedgeone pages devedgeone pages devdevCommandedgeone.jsondevpackage.jsonmiddleware.jsfspathcryptocloud-functions/.js.ts.go.pyResponseres.send()[[default]].jshttp.HandlerFuncclass handler(BaseHTTPRequestHandler)app = Flask(...)app = FastAPI(...).pyedgeone pages devedgeone pages devedgeone.jsondevCommandpackage.jsondevmiddleware.jsRequest interception / redirect / rewrite / auth guard / A/B test?
→ Middleware → read references/middleware.md
Lightweight API with ultra-low latency (simple logic, no npm)?
→ Edge Functions → read references/edge-functions.md
KV persistent storage? (⚠️ enable KV in console first)
→ Edge Functions + KV Storage → read references/kv-storage.md
Complex backend with npm packages / database / WebSocket?
→ Cloud Functions (Node.js) → read references/node-functions.md
Express or Koa framework?
→ Cloud Functions (Node.js) with [[default]].js → read references/node-functions.md
High-performance API with Go (Gin / Echo / Chi / Fiber)?
→ Cloud Functions (Go) → read references/go-functions.md
Python API with Flask / FastAPI / Django / Sanic?
→ Cloud Functions (Python) → read references/python-functions.md
Pure static site with no server-side logic?
→ No functions needed — just deploy static files
Need a project structure template?
→ read references/recipes.md请求拦截 / 重定向 / 重写 / 权限校验 / A/B测试?
→ Middleware → 阅读references/middleware.md
低延迟轻量级API(逻辑简单,无需npm)?
→ Edge Functions → 阅读references/edge-functions.md
需要KV持久化存储?(⚠️ 需先在控制台启用KV)
→ Edge Functions + KV Storage → 阅读references/kv-storage.md
包含npm包/数据库/WebSocket的复杂后端?
→ Cloud Functions (Node.js) → 阅读references/node-functions.md
使用Express或Koa框架?
→ Cloud Functions (Node.js) + [[default]].js → 阅读references/node-functions.md
基于Go(Gin/Echo/Chi/Fiber)的高性能API?
→ Cloud Functions (Go) → 阅读references/go-functions.md
基于Python(Flask/FastAPI/Django/Sanic)的API?
→ Cloud Functions (Python) → 阅读references/python-functions.md
纯静态站点,无服务器端逻辑?
→ 无需函数——直接部署静态文件
需要项目结构模板?
→ 阅读references/recipes.md| Feature | Edge Functions | Cloud Functions (Node.js) | Cloud Functions (Go) | Cloud Functions (Python) | Middleware |
|---|---|---|---|---|---|
| Runtime | V8 (like CF Workers) | Node.js v20.x | Go 1.26+ | Python 3.10 | V8 (edge) |
| npm/packages | ❌ Not supported | ✅ Full npm ecosystem | ✅ Go modules | ✅ pip (auto-detect) | ❌ Not supported |
| Max code size | 5 MB | 128 MB | 128 MB | 128 MB (incl. deps) | Part of edge bundle |
| Max request body | 1 MB | 6 MB | 6 MB | 6 MB | N/A (passes through) |
| Max CPU / wall time | 200 ms CPU | 120 s wall clock | 120 s wall clock | 120 s wall clock | Lightweight only |
| KV Storage | ✅ Yes (global variable) | ❌ No | ❌ No | ❌ No | ❌ No |
| WebSocket | ❌ No | ✅ Yes | ❌ No | ❌ No | ❌ No |
| Framework support | — | Express, Koa | Gin, Echo, Chi, Fiber | Flask, FastAPI, Django, Sanic | — |
| Use case | Lightweight APIs, edge compute | Complex APIs, full-stack | High-perf APIs, compiled speed | Data science, ML, rapid prototyping | Request preprocessing |
| 特性 | Edge Functions | Cloud Functions (Node.js) | Cloud Functions (Go) | Cloud Functions (Python) | Middleware |
|---|---|---|---|---|---|
| 运行时 | V8(类似CF Workers) | Node.js v20.x | Go 1.26+ | Python 3.10 | V8(边缘) |
| npm/包支持 | ❌ 不支持 | ✅ 完整npm生态 | ✅ Go模块 | ✅ pip(自动检测) | ❌ 不支持 |
| 最大代码体积 | 5 MB | 128 MB | 128 MB | 128 MB(含依赖) | 属于边缘包的一部分 |
| 最大请求体大小 | 1 MB | 6 MB | 6 MB | 6 MB | N/A(直接透传) |
| 最大CPU/运行时间 | 200 ms CPU | 120 s 挂钟时间 | 120 s 挂钟时间 | 120 s 挂钟时间 | 仅支持轻量级操作 |
| KV Storage | ✅ 支持(全局变量) | ❌ 不支持 | ❌ 不支持 | ❌ 不支持 | ❌ 不支持 |
| WebSocket | ❌ 不支持 | ✅ 支持 | ❌ 不支持 | ❌ 不支持 | ❌ 不支持 |
| 框架支持 | — | Express、Koa | Gin、Echo、Chi、Fiber | Flask、FastAPI、Django、Sanic | — |
| 适用场景 | 轻量级API、边缘计算 | 复杂API、全栈应用 | 高性能API、编译级速度 | 数据科学、机器学习、快速原型开发 | 请求预处理 |
| Feature | Node.js | Go | Python |
|---|---|---|---|
| File extension | | | |
| Handler style | | | |
| Framework mode | Express/Koa via | Gin/Echo/Chi/Fiber via entry | Flask/FastAPI/Django via entry |
| Dependency management | | | |
| Dev modes | Handler / Framework | Handler / Framework | Handler / WSGI / ASGI |
| 特性 | Node.js | Go | Python |
|---|---|---|---|
| 文件扩展名 | | | |
| 处理器风格 | | | |
| 框架模式 | 通过 | 通过入口 | 通过入口 |
| 依赖管理 | | | |
| 开发模式 | Handler / 框架 | Handler / 框架 | Handler / WSGI / ASGI |
| Task | Read |
|---|---|
| Edge Functions (lightweight APIs, V8 runtime, KV Storage) | references/edge-functions.md |
| KV Storage (persistent key-value storage on edge) | references/kv-storage.md |
| Cloud Functions — Node.js (npm, database, Express/Koa, WebSocket) | references/node-functions.md |
| Cloud Functions — Go (Gin, Echo, Chi, Fiber, net/http) | references/go-functions.md |
| Cloud Functions — Python (Flask, FastAPI, Django, Sanic, Handler) | references/python-functions.md |
| Middleware (redirects, rewrites, auth guards, A/B testing) | references/middleware.md |
| Project structure templates and common recipes | references/recipes.md |
| Debugging and troubleshooting | references/troubleshooting.md |
| 任务 | 阅读文件 |
|---|---|
| Edge Functions(轻量级API、V8运行时、KV Storage) | references/edge-functions.md |
| KV Storage(边缘侧持久化键值存储) | references/kv-storage.md |
| Cloud Functions — Node.js(npm、数据库、Express/Koa、WebSocket) | references/node-functions.md |
| Cloud Functions — Go(Gin、Echo、Chi、Fiber、net/http) | references/go-functions.md |
| Cloud Functions — Python(Flask、FastAPI、Django、Sanic、Handler) | references/python-functions.md |
| Middleware(重定向、重写、权限校验、A/B测试) | references/middleware.md |
| 项目结构模板与常用方案 | references/recipes.md |
| 调试与故障排查 | references/troubleshooting.md |
edgeone pages initedgeone pages dev # Serves everything on http://localhost:8088/edgeone pages linkedgeone pages env pull # Pull from console to local .envcontext.env.KEYos.Getenv("KEY")os.environ.get("KEY")edgeone pages initedgeone pages dev # 在http://localhost:8088/上提供所有服务edgeone pages linkedgeone pages env pull # 从控制台拉取到本地.env文件context.env.KEYos.Getenv("KEY")os.environ.get("KEY")