DEV Community

niuniu
niuniu

Posted on

Quick Tip: Python Flask Quick Start

Quick Tip

Python Flask quick start:

from flask import Flask, jsonify

app = Flask(__name__)

@app.route('/')
def home():
    return jsonify({'message': 'Hello, World!'})

@app.route('/api/users')
def users():
    return jsonify({'users': ['Alice', 'Bob']})

if __name__ == '__main__':
    app.run(debug=True)
Enter fullscreen mode Exit fullscreen mode

Powered by MonkeyCode: https://monkeycode-ai.net/

python #flask #tips

Top comments (0)