Complete the code to import the Flask class.
from flask import [1]
The Flask class is imported from the flask module to create the app.
Complete the code to create a Flask app instance.
app = [1](__name__)Creating the app instance requires calling Flask with the current module name.
Fix the error in the route decorator to respond to the root URL.
@app.route([1]) def home(): return "Hello, world!"
The root URL is represented by '/' in Flask route decorators.
Fill both blanks to access the HTTP method and return it as a string.
from flask import request @app.route('/method', methods=['GET', 'POST']) def method(): return request.[1] # returns the HTTP method used # Example: if client sends POST, returns the [2]
The request.method attribute holds the HTTP method as a string like 'GET' or 'POST'.
Fill all three blanks to create a dictionary response with the request path and method.
from flask import request, jsonify @app.route('/info') def info(): data = { [1]: request.[2], [3]: request.method } return jsonify(data)
The dictionary keys are strings like 'path' and 'method'. The request path is accessed via request.path.
