pvanand's picture
Update main.py
73d8d5f verified
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
import uvicorn
app = FastAPI()
@app.get("/", response_class=HTMLResponse)
async def root():
return """
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h1>Welcome to our website!</h1>
<p>Please <a href="/login">login</a> or join our <a href="/waitlist">waitlist</a>.</p>
</body>
</html>
"""
@app.get("/login", response_class=HTMLResponse)
async def login():
return """
<html>
<head>
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form action="/login" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
"""
@app.get("/waitlist", response_class=HTMLResponse)
async def waitlist():
return """
<html>
<head>
<title>Join Waitlist</title>
</head>
<body>
<h1>Join Our Waitlist</h1>
<form action="/waitlist" method="post">
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<input type="submit" value="Join Waitlist">
</form>
</body>
</html>
"""
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True, debug=True)