pip install Flask-API
python
from flask import Flask
from flask_api import FlaskAPI
python
app = FlaskAPI(__name__)
python
@app.route('/hello', methods=['GET'])
def hello():
return {'message': 'Hello, World!'}
python
@app.route('/greet/<name>', methods=['GET'])
def greet(name):
return {'message': f'Hello, {name}!'}
python
if __name__ == '__main__':
app.run(debug=True)