Spaces:
Sleeping
Sleeping
import flask | |
import flask_cors | |
import os | |
messageArray = {} | |
# sets up the app | |
app = flask.Flask(__name__) | |
flask_cors.CORS(app) | |
# creates a API endpoint for the password input | |
def password(): | |
nameIn = flask.request.get_json()['nameInput'] | |
messageIn = flask.request.get_json()['messageInput'] | |
n = len(messageArray) | |
messageArray.update({"message "+str(n): [nameIn, messageIn]}) | |
data = { | |
'messages': messageArray | |
} | |
return flask.jsonify(data) | |
if __name__ == "__main__": | |
app.run(debug=True,host="0.0.0.0",port=5000) |