File size: 928 Bytes
1bf3c37
1071322
 
 
 
 
 
1bf3c37
 
7bfa6f7
 
1bf3c37
 
7bfa6f7
 
16cd746
b664cae
16cd746
 
7bfa6f7
16cd746
 
 
 
7bfa6f7
16cd746
 
 
 
7bfa6f7
16cd746
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from fastapi import FastAPI
import os
import sys
src_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..","backend"))
sys.path.append(src_directory)

from modules import home_page
app = FastAPI()

df = home_page.process_data()

@app.get("/")
def home():
    return home_page.home()

@app.get("/continent")
def display_continents():
    continent = home_page.continent(df)
    return {"continents":continent}

@app.get("/country")
def display_country():
    country=home_page.country(df)
    return{"country":country}

@app.get("/max_population/{continent_name}")
def max_population(continent_name:str):
    max_population=home_page.max_population(df,continent_name)
    return {"max_population":max_population}


@app.get("/min_population/{continent_name}")
def min_population(continent_name:str):
    min_population=home_page.min_population(df,continent_name)
    return {"min_population":min_population}