← Flask learning path
Flask · Module 2 of 10

Routing and requests

Handle URLs, methods, query strings and form data.

📖 Key ideas

  1. Dynamic routes: @app.route("/user/<name>").
  2. Converters: <int:id>, <path:p>.
  3. Allow methods: methods=["GET", "POST"].
  4. request.args reads query strings; request.form reads form data.
  5. request.get_json() reads JSON bodies.
💡 Real-life example: Routes are post-office boxes: each number goes to the right function.
request.argsQuery string values
request.formForm fields
get_json()Parses JSON body
<int:id>Integer URL converter