From 60fbd0977591979615eaa29ffbc2db224ea0fef5 Mon Sep 17 00:00:00 2001 From: Andrew Brookins Date: Thu, 25 Nov 2021 07:27:22 -0800 Subject: [PATCH] Reference the redis-om-fastapi project --- docs/fastapi_integration.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/fastapi_integration.md b/docs/fastapi_integration.md index 8534ddf..c9d319d 100644 --- a/docs/fastapi_integration.md +++ b/docs/fastapi_integration.md @@ -28,7 +28,7 @@ This example shows how to manage these two uses of Redis within the same applica ## Example app code -This is a complete example that you can run as-is: +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. ```python import datetime @@ -105,7 +105,7 @@ async def startup(): ## Testing the app -You should install the app's dependencies first. This app uses Poetry, so you'll want to make sure you have that installed first: +You should install the app's dependencies first. This app uses Poetry, so you'll want to make sure you have Poetry installed first: $ pip install poetry @@ -115,7 +115,7 @@ Then install the dependencies: Next, start the server: - $ poetry run uvicorn --reload main:test + $ poetry run uvicorn --reload main:app Then, in another shell, create a customer: ``` @@ -123,7 +123,8 @@ Then, in another shell, create a customer: -01-02"}' {"pk":"01FM2G8EP38AVMH7PMTAJ123TA","first_name":"Andrew","last_name":"Brookins","email":"a@example.com","join_date":"2020-01-02","age":38,"bio":""} ``` -Get a copy of the value for "pk" and make another request to get that customer: + +Get a copy of the value for "pk," which is the model's primary key, and make another request to get that customer: $ curl "http://localhost:8000/customer/01FM2G8EP38AVMH7PMTAJ123TA" {"pk":"01FM2G8EP38AVMH7PMTAJ123TA","first_name":"Andrew","last_name":"Brookins","email":"a@example.com","join_date":"2020-01-02","age":38,"bio":""}