ammaan commited on
Commit
72f4984
1 Parent(s): 53a796f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +13 -5
main.py CHANGED
@@ -1,6 +1,8 @@
1
  from typing import Union
2
  import csv
3
  from fastapi import FastAPI
 
 
4
 
5
  app = FastAPI()
6
 
@@ -15,8 +17,14 @@ def load_data(filename):
15
 
16
 
17
  new_list = load_data('country.csv')
18
- listt = "hellow world how are you are yo good "
19
- @app.get("/")
20
- def read_root():
21
- return {"Hello": new_list}
22
-
 
 
 
 
 
 
 
1
  from typing import Union
2
  import csv
3
  from fastapi import FastAPI
4
+ from fastapi.staticfiles import StaticFiles
5
+ from fastapi.responses import FileResponse
6
 
7
  app = FastAPI()
8
 
 
17
 
18
 
19
  new_list = load_data('country.csv')
20
+
21
+ @app.get("/getdata")
22
+ def getData():
23
+ return {"data": new_list}}
24
+
25
+ app.mount('/',StaticFiles(directory="static",html=True),name="static")
26
+
27
+ @app.get('/')
28
+ def index() -> FileResponse:
29
+ return FileResponse('/app/static/index.html',media_type="text/html")
30
+