... | ... | @@ -60,7 +60,6 @@ async def add_process_time_header(request: Request, call_next): |
|
|
|
|
|
response.headers["X-Process-Time"] = str(process_time)
|
|
|
return response
|
|
|
|
|
|
```
|
|
|
|
|
|
Exit _insert-mode_ by pressing `Esc`, and save the file using `:w`
|
... | ... | @@ -75,4 +74,25 @@ _For the impatient out there, the issue can be forced by pressing **F5** in vim. |
|
|
|
|
|
![image](uploads/6a5a9100d676b68fdd9833d5ef578d98/image.png)
|
|
|
|
|
|
Now we can time the time spent processing the incoming requests, sweet! |
|
|
\ No newline at end of file |
|
|
Now we can time the time spent processing the incoming requests, sweet!
|
|
|
|
|
|
## But, timing isn't everything ![image](uploads/764633829cc182157688821ff3a88bbb/image.png)
|
|
|
|
|
|
We can even test our API using the browser...\
|
|
|
While you where busy coding, FastAPI was busy documenting that code using the OpenAPI standard...
|
|
|
|
|
|
Try navigating to [https://fastapi.ibmi.rocks/{id}/docs](https://fastapi.ibmi.rocks/%7Bid%7D/docs) - where `{id}` is the number assigned to you from earlier.
|
|
|
|
|
|
![image](uploads/a8190c5331707079f914a34bede74d9f/image.png)
|
|
|
|
|
|
The input arguments are documented as being required, and what type they are expecting,
|
|
|
|
|
|
Filling out the input fields, and pressing "Execute" yields some useful information...
|
|
|
|
|
|
![image](uploads/1c296e8f8aa8ca996447d0a7e8a2d130/image.png)
|
|
|
|
|
|
Going further down the page, all kinds of things are described, different sort of responses and status codes, and all the data models available, but we aren't there yet.
|
|
|
|
|
|
Clapping is allowed!
|
|
|
|
|
|
[Proceed to the next page...](Part-2b.-Organise-my-first-service) |
|
|
\ No newline at end of file |