docs(TDD): Clarify FastAPI server execution and fix markdown for Phase 4
authorSam Mirazi <sasan345@gmail.com>
Sun, 1 Jun 2025 06:49:27 +0000 (23:49 -0700)
committerSam Mirazi <sasan345@gmail.com>
Sun, 1 Jun 2025 06:49:27 +0000 (23:49 -0700)
This commit enhances the Technical Design Document (Design Docs/TDD.md) by providing explicit instructions for running the FastAPI server, pertinent to the completion of Phase 4 ("Green Implementation for FastAPI"). It also includes a minor markdown syntax correction.

Key changes:
- Added a dedicated markdown block in Phase 4 with the precise command `uvicorn app_fastapi.app:app --host 127.0.0.1 --port 8000` and context for running the FastAPI application. This makes the instruction more prominent and user-friendly.
- Removed the previous, less visible comment `# Uvicorn will run this: uvicorn app_fastapi.app:app --port 8000` from within the FastAPI Python code example to avoid redundancy and improve clarity.
- Corrected markdown code block specifiers (from ``` to ````) around the FastAPI example and the new instruction block to ensure correct rendering of the document.

These changes make it easier for anyone following the TDD to manually start and test the FastAPI server as intended at the end of Phase 4, before proceeding to the benchmarking in Phase 5.

Design Docs/TDD.md
app_fastapi/__pycache__/app.cpython-312.pyc
app_fastapi/app.py
app_flask/flask_application.py
tests/test_fastapi_route.py
tests/test_flask_route.py

index 71c232d4d8e66d54604ec815859206cf0797e4cf..3a4aa1eb7a98a1088ae08e9abdcfeda083411884 100644 (file)
@@ -253,7 +253,7 @@ _Key Tasks_
   - Includes an artificial `await asyncio.sleep(3)` (non-blocking).
   - Ensure `uvicorn` runs it on the port expected by the test (e.g., 8000).
 
-```python
+````python
 # app_fastapi/app.py (example)
 from fastapi import FastAPI, Response
 import asyncio
@@ -266,8 +266,10 @@ async def home():
     html = "<h1>Slow FastAPI Demo</h1>"
     return Response(content=html, media_type="text/html")
 
-# Uvicorn will run this: uvicorn app_fastapi.app:app --port 8000
-```
+To run this FastAPI server manually from your project root (after ensuring `uvicorn` and `fastapi` are installed in your environment), use the following command:
+```bash
+uvicorn app_fastapi.app:app --host 127.0.0.1 --port 8000
+````
 
 _Tests_
 
index 16396b34ee7129fdfa1e6260ecc348fa0b802d4d..a12b7f3b44a4d26a4f6d0901b775417de03e3922 100644 (file)
Binary files a/app_fastapi/__pycache__/app.cpython-312.pyc and b/app_fastapi/__pycache__/app.cpython-312.pyc differ
index bc0f0cf9974c143a2216bd53ac9f13277eb5bf02..8a1936c1ba08a603cce7246916f723f5cde8187c 100644 (file)
@@ -7,5 +7,5 @@ app = FastAPI()
 @app.get("/")
 async def home():
     await asyncio.sleep(3)  # simulate slow work (non-blocking)
-    html = "<h1>FastAPI Server: 3s Artificial Delay Demo</h1>"
+    html = "<h1>FastAPI Server: 3-Seconds Artificial Delay Demo</h1>"
     return Response(content=html, media_type="text/html") 
\ No newline at end of file
index 5da77ea27abc9b0aab8ecae89b8a2ddda88914b5..8dbca04b7897920bf0482de125627417b5336260 100644 (file)
@@ -7,7 +7,7 @@ app = Flask(__name__)
 @app.route("/")
 def home():
     time.sleep(3)                # simulate slow work
-    html = "<h1>Flask Server: 3s Artificial Delay Demo</h1>" # Updated content
+    html = "<h1>Flask Server: 3-Seconds Artificial Delay Demo</h1>" # Updated content
     return Response(html, mimetype="text/html")
 
 if __name__ == "__main__":
index 015dbd62b68ff7cd4ca5c191a2442cf5ea417914..40ff1d2d61efd65f5972f3c36c7d026a160ae2db 100644 (file)
@@ -49,7 +49,7 @@ async def test_home_returns_html_fastapi():
         async with httpx.AsyncClient(timeout=10) as client:
             r = await client.get(f"http://{HOST}:{PORT}/")
             assert r.status_code == 200
-            assert "<h1>FastAPI Server: 3s Artificial Delay Demo</h1>" in r.text # Expected content
+            assert "<h1>FastAPI Server: 3-Seconds Artificial Delay Demo</h1>" in r.text # Expected content
     finally:
         if server_process and server_process.is_alive():
             server_process.terminate() # Send SIGTERM
index 5185c79c28650d7ea9ec155f9ed3a39c8dfd5769..1065743ba193db7c48e86ffc259a67a32ed303ef 100644 (file)
@@ -27,7 +27,7 @@ def test_home_returns_html():
         }
         r = httpx.get("http://127.0.0.1:3000/", timeout=10, headers=headers)
         assert r.status_code == 200
-        assert "<h1>Flask Server: 3s Artificial Delay Demo</h1>" in r.text
+        assert "<h1>Flask Server: 3-Seconds Artificial Delay Demo</h1>" in r.text
     finally:
         proc.terminate()
         try: