Spaces:
Sleeping
Sleeping
Commit
·
ea29eea
1
Parent(s):
a47b44b
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,6 @@ rooms = {"123": {}}
|
|
7 |
app = flask.Flask(__name__)
|
8 |
flask_cors.CORS(app)
|
9 |
|
10 |
-
def generate_room_id():
|
11 |
-
return str(uuid.uuid4()) # Generate a unique UUID as a string
|
12 |
|
13 |
@app.route('/')
|
14 |
def index():
|
@@ -16,9 +14,18 @@ def index():
|
|
16 |
|
17 |
@app.route('/createRoom', methods=['POST'])
|
18 |
def create_room():
|
19 |
-
roomId =
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
@app.route('/postMessage', methods=['POST'])
|
24 |
def post():
|
|
|
7 |
app = flask.Flask(__name__)
|
8 |
flask_cors.CORS(app)
|
9 |
|
|
|
|
|
10 |
|
11 |
@app.route('/')
|
12 |
def index():
|
|
|
14 |
|
15 |
@app.route('/createRoom', methods=['POST'])
|
16 |
def create_room():
|
17 |
+
roomId = flask.request.get_json()['roomIdInput']
|
18 |
+
|
19 |
+
success = True
|
20 |
+
|
21 |
+
for room in rooms:
|
22 |
+
if room == roomId:
|
23 |
+
success = False
|
24 |
+
if success:
|
25 |
+
rooms.update = {roomId: {}} # Create an empty room with an empty message list
|
26 |
+
return flask.jsonify({'roomId': roomId, "success": True})
|
27 |
+
else:
|
28 |
+
return flask.jsonify({"success": False})
|
29 |
|
30 |
@app.route('/postMessage', methods=['POST'])
|
31 |
def post():
|