Most asked top Interview Questions and Answers & Online Test
Education platform for interview prep, online tests, tutorials, and live practice

Build skills with focused learning paths, mock tests, and interview-ready content.

WithoutBook brings subject-wise interview questions, online practice tests, tutorials, and comparison guides into one responsive learning workspace.

Chapter 3

Routing, View Functions, URLs, and Flask Request-Response Basics

Learn how Flask maps URLs to Python functions and how web requests become responses.

Inside this chapter

  1. What Routing Means
  2. Route Examples
  3. HTTP Methods
  4. Returning Responses
  5. Real Example

Series navigation

Study the chapters in order for the clearest path from Flask basics to scalable application design, APIs, security, and production operations. Use the navigation at the bottom to move smoothly through the full tutorial series.

Tutorial Home

Chapter 3

What Routing Means

Routing connects incoming URLs to specific Python functions, commonly called view functions. This is one of the core ideas in Flask and in web frameworks generally.

Chapter 3

Route Examples

@app.route("/about")
def about():
    return "About page"

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

Flask supports dynamic URL segments so routes can respond based on path parameters.

Chapter 3

HTTP Methods

@app.route("/submit", methods=["GET", "POST"])
def submit():
    return "Handled"

Different request methods express different intentions, such as reading, creating, updating, or deleting resources.

Chapter 3

Returning Responses

A Flask view can return plain text, rendered HTML, JSON, redirects, or custom response objects. Understanding those response types is key to building both websites and APIs.

Chapter 3

Real Example

An educational portal may use routes for home, login, course detail, student dashboard, and admin reports. Each route maps a request into the correct business logic and user-facing response.

Copyright © 2026, WithoutBook.