I have a HTML page with forms. I need to integrate it with fastapi such that it receives data from the forms.
main.py
`from fastapi import FastAPI, Request
from starlette.responses import FileResponse
app = FastAPI()
@app.get("/")
async def start():
return FileResponse("./templates/home.html")`
home.html
<!doctype html>
<body>
<div>
<label for="age">Age</label> </div>
<div>
<input type="text" class="form-control" id="age" name="age" placeholder="Enter your Age">
</select>
</div>
<button type="submit" class="btn btn-dark" value="submit">Submit</button>
</body>
</html>
I was able to return a HTML page using "return FileResponse("./templates/home.html")". But I was not able to collect data via the form in HTML page.
Thoughts are appreciated. Thanks in advance.