How routes are structured
Every route file defines a Blueprint, registers it at a URL prefix, and exposes endpoint functions that call the service layer:api/app.py:
ant generate route users, both the route file and the app.py registration are created and wired automatically.
HTTP methods
Flask Blueprints support all standard HTTP methods as decorators:Subroutes
A subroute is an additional endpoint appended to an existing Blueprint. When you runant generate subroute users profile, the following is added to users_route.py:
users_service.py and users_repository.py.
URL structure
Given a route namedusers with subroutes profile and create:
| Method | URL | Handler |
|---|---|---|
| GET | /users | get_users() |
| GET | /users/profile | get_profile() |
| POST | /users/create | create_create(data) |
Generating routes and subroutes
Naming rules
Route names must be valid Python identifiers:Accessing request data
Inside a route function, use Flask’srequest object: