-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
36 lines (24 loc) · 1.13 KB
/
app.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
#This dummy API to test if app works
from flask import Flask, session, render_template, make_response, jsonify, request, send_from_directory, g, url_for
from flask_cors import CORS
app = Flask(
__name__
)
CORS(app)
@app.route('/send', methods = ['POST'])
def handleMessageReceived():
print(request)
data = request.form['data']
print(data)
return "Success"
@app.route('/receive', methods = ['GET'])
def getMessages():
#DummyData
val1 = {"key":"sparrow_sparrow:dfad_1562021354341","userID":"sparrow","timeStamp":1562021354341,"destination":"sparrow:jay","message":"one "}
val2 = {"key":"sparrow_sparrow:dfad_1562021354390","userID":"sparrow","timeStamp":1562021354390,"destination":"sparrow:jay","message":"two "}
val3 = {"key":"sparrow_sparrow:dfad_1562021352332","userID":"sparrow","timeStamp":1562021352332,"destination":"sparrow:jay","message":"three "}
val4 = {"key":"sparrow_sparrow:dfad_1562021352532","userID":"sparrow","timeStamp":1562021352532,"destination":"sparrow:jay2","message":"four "}
data = [val1, val2, val3, val4]
return jsonify(data)
if __name__ == '__main__':
app.run()