Skip to content

Commit 7051f16

Browse files
committed
Add exercise for FastAPI chapter. Don't laugh!
1 parent 6974bf2 commit 7051f16

File tree

1 file changed

+6
-4
lines changed
  • days/009-012-modern-apis-with-fastapi

1 file changed

+6
-4
lines changed

days/009-012-modern-apis-with-fastapi/readme.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The above api endpoint `some_action` is fun, but takes no data. If we wanted to
4747
def some_action(start_index):
4848
```
4949

50-
But this is a string and index implies an integer. We could cast it ourselves, but FastAPI does that for us with validation by simply specifying the type in code, some_action(start_index: **int**):
50+
But this is a string and index implies an integer. We could parse it ourselves, but FastAPI does that for us with validation by simply specifying the type in code, some_action(start_index: **int**):
5151

5252
```python
5353
@api.get('/{start_index}')
@@ -69,11 +69,13 @@ It's preferable to use this as the type in FastAPI because FastAPI will automati
6969

7070
### Your Joke API
7171

72-
Use what we've given you above along with `pyjokes`, which you'll need to install as a dependency along with fastapi and uvicorn, to build a FastAPI that will listen at then URL:
72+
Use what we've given you above along with `pyjokes`, which you'll need to install as a dependency along with fastapi and uvicorn, to build a FastAPI that will listen at the URLs:
7373

74-
`http://127.0.0.1:8001/api/laugh/chuck/en`
74+
- `http://127.0.0.1:8001/api/laugh/chuck/en`
75+
- `http://127.0.0.1:8001/api/laugh/neutral/en`
76+
- `http://127.0.0.1:8001/api/laugh/chuck/es`
7577

76-
And pass in both the category and language (again see [the pyjokes API](https://pyjok.es/api/) for how to use it and valid inputs).
78+
Passing in both the category and language (again see [the pyjokes API](https://pyjok.es/api/) for how to use it and valid inputs).
7779

7880
The response should be a JSON value such as:
7981

0 commit comments

Comments
 (0)