Skip to content

Commit 60fbd09

Browse files
author
Andrew Brookins
committed
Reference the redis-om-fastapi project
1 parent 269d44c commit 60fbd09

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/fastapi_integration.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This example shows how to manage these two uses of Redis within the same applica
2828

2929
## Example app code
3030

31-
This is a complete example that you can run as-is:
31+
Let's look at an example FastAPI app that uses Redis OM. I'll include the code here, but to actually run the example, you'll want to check out the [redis-om-fastapi](https://github.com/redis-developer/redis-om-fastapi) repository from GitHub, which includes the `pyproject.toml` file needed to install the app's dependencies.
3232

3333
```python
3434
import datetime
@@ -105,7 +105,7 @@ async def startup():
105105

106106
## Testing the app
107107

108-
You should install the app's dependencies first. This app uses Poetry, so you'll want to make sure you have that installed first:
108+
You should install the app's dependencies first. This app uses Poetry, so you'll want to make sure you have Poetry installed first:
109109

110110
$ pip install poetry
111111

@@ -115,15 +115,16 @@ Then install the dependencies:
115115

116116
Next, start the server:
117117

118-
$ poetry run uvicorn --reload main:test
118+
$ poetry run uvicorn --reload main:app
119119

120120
Then, in another shell, create a customer:
121121
```
122122
$ curl -X POST "http://localhost:8000/customer" -H 'Content-Type: application/json' -d '{"first_name":"Andrew","last_name":"Brookins","email":"[email protected]","age":"38","join_date":"2020
123123
-01-02"}'
124124
{"pk":"01FM2G8EP38AVMH7PMTAJ123TA","first_name":"Andrew","last_name":"Brookins","email":"[email protected]","join_date":"2020-01-02","age":38,"bio":""}
125125
```
126-
Get a copy of the value for "pk" and make another request to get that customer:
126+
127+
Get a copy of the value for "pk," which is the model's primary key, and make another request to get that customer:
127128

128129
$ curl "http://localhost:8000/customer/01FM2G8EP38AVMH7PMTAJ123TA"
129130
{"pk":"01FM2G8EP38AVMH7PMTAJ123TA","first_name":"Andrew","last_name":"Brookins","email":"[email protected]","join_date":"2020-01-02","age":38,"bio":""}

0 commit comments

Comments
 (0)