From 44417775dc81f2224f66f403a8730e09af29a547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Pito=C5=84?= Date: Mon, 24 Jun 2019 11:46:46 +0200 Subject: [PATCH] Update framework example in readme --- README.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4de0e8b0..cf0dfd7f 100644 --- 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) ```