chatbox2 / main.py
jacobinathanialpeterson's picture
Rename app.py to main.py
0c3de86
raw
history blame
613 Bytes
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
@app.route('/messages', methods=['POST'])
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)