-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
29 lines (18 loc) · 666 Bytes
/
Copy pathapp.py
File metadata and controls
29 lines (18 loc) · 666 Bytes
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
from flask import Flask, send_from_directory, jsonify, redirect, request
from products import getPopularProducts, getPersonalProducts
app = Flask(__name__)
@app.route('/')
def home():
return redirect("/index.html", code=302)
@app.route('/<path:filename>')
def download_file(filename):
return send_from_directory('static', filename, as_attachment=False)
@app.route('/popularproducts')
def popularproducts():
return jsonify(getPopularProducts())
@app.route('/personalproducts', methods=['POST'])
def personalproducts():
sessiondata = request.json
return jsonify(getPersonalProducts(sessiondata))
if __name__ == '__main__':
app.run()