Flask route names typically use lowercase letters and hyphens to separate words for readability and SEO benefits. So /user-profile is preferred.
@app.route('/dashboard/'), what happens when a user visits /dashboard (without the trailing slash)?Flask automatically redirects requests missing a trailing slash to the route with the slash if the route is defined with a trailing slash.
@app.route(...)
Flask uses <type:variable_name> syntax. The correct type for integers is int, so /user/<int:user_id> is correct.
@app.route('/item/') @app.route('/item/new')What problem will occur when a user visits
/item/new?The route with the variable <id> will match any string, including 'new', so the static route /item/new will never be matched.
1.
@app.route('/post/') 2.
@app.route('/post/archive')3.
@app.route('/post/') In what order does Flask check these routes when a user visits
/post/archive?Flask checks routes in the order they are declared. So if the integer parameter route is declared first, it tries that before the static route.
