-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
119 lines (104 loc) · 3.14 KB
/
Copy pathapp.py
File metadata and controls
119 lines (104 loc) · 3.14 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
from flask import Flask, jsonify
from flask_cors import CORS
# initialize a flask application (app)
app = Flask(__name__)
CORS(app, supports_credentials=True, origins='*') # Allow all origins (*)
# ... your existing Flask
# add an api endpoint to flask app
@app.route('/api/Keerthan')
def get_data():
# start a list, to be used like a information database
InfoDb = []
# add a row to list, an Info record
InfoDb.append({
"FirstName": "Keerthan",
"LastName": "Karumudi",
"DOB": "December 24",
"Residence": "San Diego",
"Email": "keerthansaikarumudi@stu.powayusd.com",
"Favorite_Movies": [ "Hangover, Superbad, Jurassic Park, Ted"]
})
@app.route('/api/Zach')
def get_data():
# start a list, to be used like a information database
InfoDb = []
# add a row to list, an Info record
InfoDb.append({
"FirstName": "Zachary",
"FirstName": "Maxwell",
"LastName": "Gaudinez",
"DOB": "January 31",
"Residence": "San Diego",
"Email": "maxwellg56824@stu.powayusd.com",
"Owns_Cars": ["2022_BMW_X6, Volvo_XC90, Volvo_S60, Mercedes_GLE350"]
})
InfoDb.append({
"FirstName": "Daksha",
"LastName": "Gowda",
"DOB": "August 15",
"Residence": "San Diego",
"Email": "dakshag45035@stu.powayusd.com",
"favorite_pokemon": ["Rayquaza, Yveltal, Zygarde"]
})
InfoDb.append({
"FirstName": "Zach",
"LastName": "Peltz",
"DOB": "March 22",
"Residence": "San Diego",
"Email": "zacharyp16044@stu.powayusd.com",
"favorite_pokemon": ["Arceus, Dialga, Lugia"]
})
@app.route('/api/Maxwell')
def get_data():
# start a list, to be used like a information database
InfoDb = []
# add a row to list, an Info record
InfoDb.append({
"FirstName": "Maxwell",
"LastName": "Gaudinez",
"DOB": "January 31",
"Residence": "San Diego",
"Email": "maxwellg56824@stu.powayusd.com",
"Owns_Cars": ["2022_BMW_X6"]
})
@app.route('/api/Daksha')
def get_data():
# start a list, to be used like a information database
InfoDb = []
InfoDb.append({
"FirstName": "Daksha",
"LastName": "Gowda",
"DOB": "August 15",
"Residence": "San Diego",
"Email": "dakshag45035@stu.powayusd.com",
"favorite_pokemon": ["Xernias, Yveltal, Zygarde"]
})
@app.route('/api/Ian')
def get_data():
# start a list, to be used like a information database
InfoDb = []
InfoDb.append({
"FirstName": "Ian",
"LastName": "Manangan",
"DOB": "March 7",
"Residence": "San Diego",
"Email": "Ianm02879@stu.powayusd.com",
"favorite_pokemon": ["Moltres, Zapdos, Articuno"]
})
return jsonify(InfoDb)
# add an HTML endpoint to flask app
@app.route('/')
def say_hello():
html_content = """
<html>
<head>
<title>Hellox</title>
</head>
<body>
<h2>Hello, World!</h2>
</body>
</html>
"""
return html_content
if __name__ == '__main__':
app.run(port=5002) # Use a different port, e.g., 5002