-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.py
51 lines (42 loc) · 1.32 KB
/
server.py
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
from flask import Flask, request
from main import *
app = Flask(__name__)
# send expiry list
@app.route('/elist',methods=['POST','GET'])
def send_elist_data():
e_list = expiryList()
return e_list
# send limited time food list
@app.route('/ltf',methods=['POST','GET'])
def send_ltf_data():
ltf = limitedTimeFoods()
return ltf
# send addFood list
@app.route('/returnList', methods=['POST','GET'])
def return_list_data():
#e_list = expiryList()
selected_item_name = request.form.to_dict()
change_dict_to_txt(selected_item_name)
return selected_item_name
#Get recipe request
@app.route('/getRecipe', methods=['POST', 'GET'])
def send_ingredients():
response = request.form.to_dict()
recipe = getRecipe(response)
print(recipe)
return recipe
# send removefood list
@app.route('/removeList',methods=['POST','GET'])
def remove_list_data():
#e_list = expiryList()
print('inside remove list')
selected_item_name = request.form.to_dict()
print('form data is', selected_item_name)
removeFood(selected_item_name['name'], selected_item_name['quantity'])
return selected_item_name
# root page
@app.route('/')
def index():
return app.send_static_file("index.html")
if __name__ == '__main__':
app.run(host='0.0.0.0', port=3000)