You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: days/009-012-modern-apis-with-fastapi/readme.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ The above api endpoint `some_action` is fun, but takes no data. If we wanted to
47
47
defsome_action(start_index):
48
48
```
49
49
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**):
51
51
52
52
```python
53
53
@api.get('/{start_index}')
@@ -69,11 +69,13 @@ It's preferable to use this as the type in FastAPI because FastAPI will automati
69
69
70
70
### Your Joke API
71
71
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:
73
73
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`
75
77
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).
0 commit comments