Kadigas commited on
Commit
fd0249a
·
1 Parent(s): 0ed4131

feat: serve html on root

Browse files
Files changed (2) hide show
  1. __pycache__/main.cpython-310.pyc +0 -0
  2. main.py +11 -2
__pycache__/main.cpython-310.pyc CHANGED
Binary files a/__pycache__/main.cpython-310.pyc and b/__pycache__/main.cpython-310.pyc differ
 
main.py CHANGED
@@ -29,10 +29,19 @@ class Req(BaseModel):
29
  region: int
30
 
31
 
32
- @app.get("/")
33
- async def root():
34
  return {"message": "Hello World. Welcome to FastAPI!"}
35
 
 
 
 
 
 
 
 
 
 
36
 
37
  def form_req(age: str = Form(...), sex: str = Form(...), smoker: str = Form(...),
38
  bmi: str = Form(...), children: str = Form(...), region: str = Form(...)):
 
29
  region: int
30
 
31
 
32
+ @app.get("/welcomeMessage")
33
+ async def welcome():
34
  return {"message": "Hello World. Welcome to FastAPI!"}
35
 
36
+ @app.get("/")
37
+ async def root(request: Request):
38
+ return templates.TemplateResponse(
39
+ "index.html",
40
+ {
41
+ "request": request,
42
+ "insurance_cost": 0,
43
+ }
44
+ )
45
 
46
  def form_req(age: str = Form(...), sex: str = Form(...), smoker: str = Form(...),
47
  bmi: str = Form(...), children: str = Form(...), region: str = Form(...)):