| 1 | from fastapi import FastAPI |
| 2 | |
| 3 | app = FastAPI() |
| 4 | |
| 5 | @app.get("/") |
| 6 | def read_root(): |
| 7 | return {"Hello": "World"} |
| 8 | |
| 9 | @app.get("/landing") |
| 10 | def read_landing_page(): |
| 11 | return {"message": "Welcome to the landing page"} |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | # Import the FastAPI class from the fastapi module |
| 16 | from fastapi import FastAPI |
| 17 | |
| 18 | # Create an instance of the FastAPI application |
| 19 | app = FastAPI() |
| 20 | |
| 21 | # Define a route for the root endpoint ("/") |
| 22 | @app.get("/") |
| 23 | def read_root(): |
| 24 | # Return a simple JSON response |
| 25 | return {"Hello": "World"} // This is an example comment |
| 26 | |
| 27 | # Define a route for the landing page endpoint ("/landing") |
| 28 | @app.get("/landing") |
| 29 | def read_landing_page(): |
| 30 | # Return a JSON response with a welcome message |
| 31 | return {"message": "Welcome to the landing page"} |
| 32 | |
| 33 | --- |
| 34 | |
| 35 | + # Import the FastAPI class from the fastapi module |
| 36 | from fastapi import FastAPI |
| 37 | |
| 38 | + # Create an instance of the FastAPI application |
| 39 | app = FastAPI() |
| 40 | |
| 41 | + # Define a route for the root endpoint ("/") |
| 42 | @app.get("/") |
| 43 | def read_root(): |
| 44 | + # Return a simple JSON response |
| 45 | + return {"Hello": "World"} // This is an example comment |
| 46 | + |
| 47 | + # Define a route for the landing page endpoint ("/landing") |
| 48 | - return {"Hello": "World"} |
| 49 | - |
| 50 | @app.get("/landing") |
| 51 | def read_landing_page(): |
| 52 | + # Return a JSON response with a welcome message |
| 53 | return {"message": "Welcome to the landing page"} |