]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Update framework example in readme 561/head
authorRafał Pitoń <rafal@mirumee.com>
Mon, 24 Jun 2019 09:46:46 +0000 (11:46 +0200)
committerRafał Pitoń <rafal@mirumee.com>
Mon, 24 Jun 2019 09:46:46 +0000 (11:46 +0200)
README.md

index 4de0e8b02f8b4ea69282fafab97bb3608bb997db..cf0dfd7ff9bcbaf8e1a528fb1a8e3104bffe6868 100644 (file)
--- a/README.md
+++ b/README.md
@@ -101,20 +101,16 @@ an ASGI toolkit. You can use any of its components independently.
 from starlette.responses import PlainTextResponse
 
 
-class App:
-    def __init__(self, scope):
-        assert scope['type'] == 'http'
-        self.scope = scope
-
-    async def __call__(self, receive, send):
-        response = PlainTextResponse('Hello, world!')
-        await response(receive, send)
+async def app(scope, receive, send):
+    assert scope['type'] == 'http'
+    response = PlainTextResponse('Hello, world!')
+    await response(scope, receive, send)
 ```
 
-Run the `App` application in `example.py`:
+Run the `app` application in `example.py`:
 
 ```shell
-$ uvicorn example:App
+$ uvicorn example:app
 INFO: Started server process [11509]
 INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
 ```