Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • F FastAPI
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Sitemule
  • Public
  • workshops
  • open source on IBM i
  • FastAPI
  • Wiki
  • Part 2a. Extending my first service

Part 2a. Extending my first service · Changes

Page history
Update Part 2a. Extending my first service authored Oct 30, 2021 by Jens Melgard Churchill's avatar Jens Melgard Churchill
Hide whitespace changes
Inline Side-by-side
Part-2a.-Extending-my-first-service.md
View page @ 5e3135c1
......@@ -47,7 +47,7 @@ Lets take advantage of that, to add timing data our request/response cycle, run
Enter insert-mode ( press `i` ), and insert the following code at line 7 ( below `app = FastAPI()` )
```plaintext
```python
from time import time
from fastapi import Request
......@@ -61,11 +61,13 @@ 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`
The server will auto-reload your changes within 5 seconds
_*Note*: For the impatient out there, the issue can be forced by pressing *F5* in vim_
The server will auto-reload your changes within 5 seconds
_**Note**: For the impatient out there, the issue can be forced by pressing **F5** in vim_
Change to your browser window, and refresh the page from before by pressing *F5*
\ No newline at end of file
Change to your browser window, and refresh the page from before by pressing **F5**
_**Note**: While the server reloads the changes, the browser might display "bad gateway" or "unreachable site" messages._
\ No newline at end of file
Clone repository
  • Part 1a. My first service
  • Part 1b. Testing my first service
  • Part 2a. Extending my first service
  • Part 2b. Organise my first service
  • Part 3a. Review my first service
  • Part 3b. Connecting my first service
  • Home