Flask 3 · Routes and requests

Capture part of the URL

Convert the value to an integer with a converter.

@app.get("/users/<int:user_id>")
def show_user(user_id):
    return f"User {user_id}"

Official Flask 3 documentation

More routes and requests commands

All routes and requests commands · Flask 3 cheatsheet

Was this page helpful?