Flask Routing — a practical guide to Flask routing with clear examples you can reuse in real projects.
Python Tutorial Series (67/95). Prefer one article? Read the complete Python tutorial.
Short description
Routes connect HTTP paths/methods to Python functions that return responses.
Routes
from flask import Flask
app = Flask(__name__)
@app.get('/hello/<name>')
def hello(name):
return f'Hello {name}'
@app.post('/items')
def create_item():
return {'ok': True}, 201