Last active
November 14, 2018 13:28
-
-
Save pedrohbtp/958224371afd40970a41b88ba0ad5336 to your computer and use it in GitHub Desktop.
Basic Flask Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
import flask | |
import json | |
from flask import Response | |
app = Flask(__name__) | |
@app.route('/test',methods=['GET']) | |
def test(): | |
''' | |
GET: Receives the request in /test route and returns a response containing {"response": "test"} | |
''' | |
resp = Response(response=json.dumps({"response": "test"}), status=200, mimetype='application/json') | |
return resp | |
if __name__ == '__main__': | |
app.run(debug=True, host='0.0.0.0', port=8082) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment