Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
The step 3 in the exercise will now use GitHub Copilot Chat
  • Loading branch information
alfredodeza authored Apr 10, 2024
1 parent 9d1bc31 commit a80cb58
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down

0 comments on commit a80cb58

Please sign in to comment.