Flask uses @app.route('/path') decorator above a function to define routes.
Step 2: Check each option for correct syntax
@app.route('/health')
def health():
return {'status': 'ok'} correctly uses @app.route decorator and defines a function returning a dictionary. Others miss the decorator or define incorrectly.
Final Answer:
@app.route('/health')\ndef health():\n return {'status': 'ok'} -> Option D
Quick Check:
Use @app.route decorator for routes [OK]
Quick Trick:Use @ before app.route to define Flask routes [OK]
Common Mistakes:
MISTAKES
Forgetting the @ symbol before app.route
Returning a dictionary without a function
Assigning route to a variable instead of a function
Master "Deployment" in Flask
9 interactive learning modes - each teaches the same concept differently