Sanic + EdgeOne Pages

Async Python 3.8+ web server and web framework that's written to go fast. Build fast, run fast, scale fast.

cloud-functions/api/[[default]].py
from sanic import Sanic
from sanic.response import json
import time

app = Sanic("SanicApp")

@app.route("/")
async def index(request):
    return json({
        "message": "Hello from Sanic Cloud Function!",
        "framework": "Sanic",
        "timestamp": time.time()
    })

@app.route("/users/<user_id:int>")
async def get_user(request, user_id):
    return json({
        "user_id": user_id,
        "username": f"user_{user_id}"
    })

API Endpoints

GET/api/info

Returns Sanic app metadata and runtime information

GET/api/users/42

Fetch user by typed path param <user_id:int>

POST/api/users

Create user with request.json body parsing

Request Body:

{
  "username": "alice",
  "email": "alice@example.com"
}
GET/api/search?q=sanic&limit=3

Search with request.args query parameters

Blazing Fast

One of the fastest Python web frameworks with C-level performance

Async Native

Built from the ground up with async/await for maximum concurrency

Production Ready

Battle-tested in production with built-in TLS, compression, and more