轻量级 ASGI 框架,构建异步 Web 项目

天问 da4d610d63 Update 'README.md' 1 week ago
README.md da4d610d63 Update 'README.md' 1 week ago

README.md

starlette

轻量级 ASGI 框架,构建异步 Web 项目

Usage

pip install starlette

from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route

async def homepage(request):
    return JSONResponse({'hello': 'world'})

app = Starlette(debug=True, routes=[
    Route('/', homepage),
])

uvicorn example:app

Reference