Browse Source

Update 'README.md'

天问 11 months ago
parent
commit
5b18eea704
1 changed files with 21 additions and 1 deletions
  1. 21 1
      README.md

+ 21 - 1
README.md

@@ -1,3 +1,23 @@
 # starlette
 
-轻量级 ASGI 框架,构建异步 Web 项目
+轻量级 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
+
+```