Skip to content

Commit

Permalink
docs; polish docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Sep 16, 2024
1 parent 48c4aac commit 2f6237d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions docs/docs/en/getting-started/asgi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion faststream/asgi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2f6237d

Please sign in to comment.