Skip to main content
BackAnt uses Flask’s Blueprint system to organize routes. Each resource gets its own Blueprint registered at a URL prefix.

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:
The Blueprint is then registered in api/app.py:
When you run 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 run ant generate subroute users profile, the following is added to users_route.py:
And a corresponding method is added to users_service.py and users_repository.py.

URL structure

Given a route named users with subroutes profile and create:

Generating routes and subroutes

See the CLI Reference for all options.

Naming rules

Route names must be valid Python identifiers:
The route name determines the URL prefix, file names, class names, and singleton names — see Architecture for the full naming table.

Accessing request data

Inside a route function, use Flask’s request object:
See Requests for full details.