Files
continue/core/diff/test-examples/add-comments.py.diff
2024-09-13 01:13:06 -07:00

53 lines
1.3 KiB
Diff

from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/landing")
def read_landing_page():
return {"message": "Welcome to the landing page"}
---
# Import the FastAPI class from the fastapi module
from fastapi import FastAPI
# Create an instance of the FastAPI application
app = FastAPI()
# Define a route for the root endpoint ("/")
@app.get("/")
def read_root():
# Return a simple JSON response
return {"Hello": "World"} // This is an example comment
# Define a route for the landing page endpoint ("/landing")
@app.get("/landing")
def read_landing_page():
# Return a JSON response with a welcome message
return {"message": "Welcome to the landing page"}
---
+ # Import the FastAPI class from the fastapi module
from fastapi import FastAPI
+ # Create an instance of the FastAPI application
app = FastAPI()
+ # Define a route for the root endpoint ("/")
@app.get("/")
def read_root():
+ # Return a simple JSON response
+ return {"Hello": "World"} // This is an example comment
+
+ # Define a route for the landing page endpoint ("/landing")
- return {"Hello": "World"}
-
@app.get("/landing")
def read_landing_page():
+ # Return a JSON response with a welcome message
return {"message": "Welcome to the landing page"}