From 2f6237d2082fa7dd36edb6bbd518fc8f2ebf19b9 Mon Sep 17 00:00:00 2001 From: Nikita Pastukhov Date: Tue, 17 Sep 2024 00:04:16 +0300 Subject: [PATCH] docs; polish docs --- docs/docs/en/getting-started/asgi.md | 13 ++++++------- faststream/asgi/app.py | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/docs/en/getting-started/asgi.md b/docs/docs/en/getting-started/asgi.md index 6ea640d3c5..d0aae2ae06 100644 --- a/docs/docs/en/getting-started/asgi.md +++ b/docs/docs/en/getting-started/asgi.md @@ -118,7 +118,7 @@ Now, your **AsyncAPI HTML** representation can be found by the `/docs` url. You may also use regular `FastStream` application object for similar result -```python linenums="1" hl_lines="2 9" +```python linenums="1" hl_lines="10" from faststream import FastStream from faststream.nats import NatsBroker from faststream.asgi import make_ping_asgi, AsgiResponse @@ -128,7 +128,6 @@ broker = NatsBroker() async def liveness_ping(scope, receive, send): return AsgiResponse(b"", status_code=200) - app = FastStream(broker).as_asgi( asgi_routes=[ ("/liveness", liveness_ping), @@ -138,12 +137,12 @@ app = FastStream(broker).as_asgi( ) ``` -``` tip - For app which use ASGI you may use cli command like for default FastStream app +!!! tip + For app which use ASGI you may use cli command like for default FastStream app - ```shell - faststream run main:app --host 0.0.0.0 --port 1337 --workers 4 - ``` + ```shell + faststream run main:app --host 0.0.0.0 --port 8000 --workers 4 + ``` ## Other ASGI Compatibility diff --git a/faststream/asgi/app.py b/faststream/asgi/app.py index 3582bb1081..79cc685e47 100644 --- a/faststream/asgi/app.py +++ b/faststream/asgi/app.py @@ -151,7 +151,7 @@ async def run( run_extra_options = {} port = int(run_extra_options.pop("port", 8000)) # type: ignore[arg-type] workers = int(run_extra_options.pop("workers", 1)) # type: ignore[arg-type] - host = str(run_extra_options.pop("host", "localhost")) + host = str(run_extra_options.pop("host", "127.0.0.1")) config = uvicorn.Config( self, host=host,