Posted by Adam on August 24, 2022
安裝 Flask ```bash pip install Flask ``` 建立 Flask app.py ```py from flask import Flask, jsonify app = Flask(__name__) @app.route('/hello') def hello(): person = {"name": "Alice", "age": 30, "city": "Taipei"} return jsonify(person) if __name__ == '__main__': app.run() ``` 執行 Flask app ```bash export FLASK_APP=app.py flask run ``` http://localhost:5000/hello