first html test
Browse files- app.py +8 -0
- index.html +45 -0
app.py
CHANGED
|
@@ -1,7 +1,15 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
|
| 3 |
app = FastAPI()
|
| 4 |
|
| 5 |
@app.get("/")
|
| 6 |
def greet_json():
|
| 7 |
return {"Hello": "World!"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from fastapi.responses import HTMLResponse
|
| 3 |
|
| 4 |
app = FastAPI()
|
| 5 |
|
| 6 |
@app.get("/")
|
| 7 |
def greet_json():
|
| 8 |
return {"Hello": "World!"}
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@app.get("/", response_class=HTMLResponse)
|
| 12 |
+
async def serve_html():
|
| 13 |
+
# Read the HTML file content
|
| 14 |
+
html_content = html_file_path.read_text(encoding='utf-8')
|
| 15 |
+
return HTMLResponse(content=html_content, status_code=200)
|
index.html
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Welcome</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
font-family: Arial, sans-serif;
|
| 10 |
+
background-color: #f0f8ff; /* Light blue background */
|
| 11 |
+
color: #333; /* Darker text for better readability */
|
| 12 |
+
margin: 0;
|
| 13 |
+
padding: 0;
|
| 14 |
+
display: flex;
|
| 15 |
+
justify-content: center;
|
| 16 |
+
align-items: center;
|
| 17 |
+
height: 100vh;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.welcome-container {
|
| 21 |
+
text-align: center;
|
| 22 |
+
background-color: #ffffff; /* White background for the welcome message */
|
| 23 |
+
padding: 20px;
|
| 24 |
+
border-radius: 10px;
|
| 25 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
h1 {
|
| 29 |
+
color: #008080; /* Teal color for the heading */
|
| 30 |
+
font-size: 36px;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
p {
|
| 34 |
+
font-size: 18px;
|
| 35 |
+
color: #555555; /* Slightly lighter text for the paragraph */
|
| 36 |
+
}
|
| 37 |
+
</style>
|
| 38 |
+
</head>
|
| 39 |
+
<body>
|
| 40 |
+
<div class="welcome-container">
|
| 41 |
+
<h1>Welcome to Our Website!</h1>
|
| 42 |
+
<p>We're glad to have you here. Explore and enjoy your stay!</p>
|
| 43 |
+
</div>
|
| 44 |
+
</body>
|
| 45 |
+
</html>
|