-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser server-v.01
48 lines (38 loc) · 1.5 KB
/
User server-v.01
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
from flask_pymongo import pymongo
from flask import Flask
from flask import Flask,jsonify,request
import sys
client = pymongo.MongoClient('mongodb://adminuser:Farnood2019@docdb-2019-11-19-17-18-38.cluster-cilajgzl9zks.us-east-1.docdb.amazonaws.com:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&replicaSet=rs0')
db = client.UserDB
col = db.UserCollection
col.insert_one({'userid':'Amazon DocumentDB'})
x = col.find_one({'userid':'Amazon DocumentDB'})
print(x)
client.close()
app = Flask(__name__)
@app.route('/' ,methods=['GET'])
def test():
return 'hello'
@app.route('/api/users/<userid>' , methods=['GET'])
def get_user_test(userid):
return ({'message' : "Done"})
@app.route('/api/users/<userid>/profile' , methods=['GET'])
def get_profile_test(userid):
return ({'message' : "Done"})
@app.route('/api/users/<userid>', methods=['PUT'])
def put_user_test(userid):
return jsonify({'message':"Updated" })
@app.route('/api/users/<userid>/profile', methods=['PUT'])
def put_profile_test(userid):
return jsonify({'message':"Updated" })
@app.route('/api/users/<userid>/notifications', methods=['DELETE'])
def delete_notifications_test(userid):
return ({'message' : "Done"})
@app.route('/api/users/<userid>/notifications', methods=['POST'])
def post_notification_test(userid):
return jsonify({'Message':"Created"})
@app.route('/api/matches/<userid>', methods = ['GET'])
def get_matches_test(userid):
return ({'message' : "Done"})
if __name__== "__main__":
app.run(host="0.0.0.0", port=88)