From a80cb58b05ffbe9f6efb1d1ffc0239642476e114 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Wed, 10 Apr 2024 10:51:10 -0400 Subject: [PATCH] Update README.md The step 3 in the exercise will now use GitHub Copilot Chat --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c8d3b63..5611890 100644 --- a/README.md +++ b/README.md @@ -31,18 +31,12 @@ Next, generate a new endpoint with GitHub Copilot by adding the comment: # Create a FastAPI endpoint that accepts a POST request with a JSON body containing a single field called "text" and returns a checksum of the text ``` -### 🐍 Step 3: Add necessary imports +### 🐍 Step 3: Explain code -The generated code causes the application to crash. The crash happens because the `base64` and `os` modules aren't imported. Add the following lines to the top of the file: - -```python -import base64 -import os -``` +The `generate()` route creates a pseudo-random token ID using a single line that might be difficult to fully understand. Select the whole function, and then right click on the selection, then select the Copilot menu item, and then the _"Explain This"_ option. The GitHub Copilot chat interface will open to the left and provide you a useful explanation which you can use to interactively ask more questions. Finally, verify the new endpoint is working by trying it out by going to the `/docs` endpoint and confirming that the endpoint shows up. - 🚀 Congratulations, through the exercise, you haven't only used copilot to generate code but also done it in an interactive and fun way! You can use GitHub Copilot to not only generate code, but write documentation, test your applications and more.