Skip to content

Commit

Permalink
docs: fix ASGI page markup (#1826)
Browse files Browse the repository at this point in the history
* docs: fix ASGI page markup

* Minor rewording

---------

Co-authored-by: Kumaran Rajendhiran <[email protected]>
  • Loading branch information
Lancetnik and kumaranvpl authored Oct 2, 2024
1 parent fb1ce98 commit 7adf1b8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions docs/docs/en/getting-started/asgi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ search:

# ASGI Support

Often you need to not just run your application to consume messages, but make it an actual part of your services ecosystem with *Prometheus metrics*, K8S *liveness* and *readiness probes*, *traces* and other observability features.
Often, you need not only to run your application to consume messages but also to make it a part of your service ecosystem with *Prometheus metrics*, K8S *liveness* and *readiness probes*, *traces*, and other observability features.

Unfortunately, such functionalilty can't be implemented by broker features alone, and you have to provide several **HTTP** endpoints in your app.

Expand All @@ -36,7 +36,7 @@ This simple example allows you to run the app using regular **ASGI** servers:
uvicorn main:app
```

It does nothing but launching the app itself as an **ASGI lifespan**.
It does nothing but launch the app itself as an **ASGI lifespan**.

### ASGI Routes

Expand Down Expand Up @@ -114,11 +114,11 @@ app = AsgiFastStream(

Now, your **AsyncAPI HTML** representation can be found by the `/docs` url.

### FastStream object reusage
### FastStream Object Reuse

You may also use regular `FastStream` application object for similar result
You may also use regular `FastStream` application object for similar result.

```python linenums="1" hl_lines="2 9"
```python linenums="1" hl_lines="2 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 apps that use ASGI, you may use the CLI command just like for the default FastStream app

```shell
faststream run main:app --host 0.0.0.0 --port 8000 --workers 4
```
```shell
faststream run main:app --host 0.0.0.0 --port 8000 --workers 4
```

## Other ASGI Compatibility

Expand Down

0 comments on commit 7adf1b8

Please sign in to comment.