Recall & Review
beginner
What is the purpose of route naming conventions in Flask?
Route naming conventions help keep URLs clear, consistent, and easy to understand for both developers and users. They make the app easier to maintain and navigate.
Click to reveal answer
beginner
Why should route names be lowercase and use hyphens instead of underscores?
Lowercase and hyphens improve readability and are more user-friendly in URLs. Hyphens separate words clearly, while underscores can be harder to spot in links.
Click to reveal answer
intermediate
How should RESTful routes be named for resources in Flask?
Use plural nouns for resource names (e.g., '/users') and HTTP methods to define actions (GET for read, POST for create, PUT/PATCH for update, DELETE for delete).
Click to reveal answer
beginner
What is a good practice for naming dynamic route parameters in Flask?
Use clear and descriptive names inside angle brackets, like '/user/<user_id>', so it’s obvious what data the route expects.
Click to reveal answer
beginner
Why avoid using file extensions (like .html) in Flask route URLs?
Avoiding file extensions keeps URLs clean and flexible. It also separates the URL from the technology used to render the page, making future changes easier.
Click to reveal answer
Which of these is the best route name for a list of blog posts in Flask?
✗ Incorrect
Using lowercase with hyphens ('/blog-posts') is the clearest and most readable convention for URLs.
How should you name a route that shows details for a single user?
✗ Incorrect
Use plural resource name with a descriptive dynamic parameter: '/users/'.
Which HTTP method is typically used with the route '/users' to create a new user?
✗ Incorrect
POST is used to create new resources at the given route.
Why should URLs avoid including file extensions like '.html'?
✗ Incorrect
Avoiding file extensions keeps URLs clean and independent of the rendering technology.
What is the recommended way to separate words in Flask route URLs?
✗ Incorrect
Hyphens improve readability and are preferred for separating words in URLs.
Explain the key principles of naming routes in Flask for a beginner.
Think about how URLs should look simple and clear for users and developers.
You got /5 concepts.
Describe how RESTful route naming works in Flask and why it is helpful.
Consider how different HTTP methods map to actions like create, read, update, and delete.
You got /4 concepts.