The most basic flask service returns a single string
1 2 3 4 5 6 7 8 9 10 11 12 | from flask import Flask, request api = Flask(__name__) @api.route("/") def hello_world(): return "Hello, World!" if __name__ == "__main__": api.run(host="0.0.0.0", port=8080, debug=True) |
If you are running this in a Docker container, don’t forget the “host=’0.0.0.0′” parameter or you end up with the following response
This page isn’t working
localhost didn’t send any data.
ERR_EMPTY_RESPONSE