14.2.9. URLs and routes
This document summarizes the current URL and route naming conventions. These rules are taken into account in some parts of backend and frontend logic (CORS, client-side routes).
14.2.9.1. URLs
URLs are split into three categories:
API URLs - accessed by the fronted and libraries.
Static URLs - used to serve static content.
User URLs - viewed by users in browsers.
API URLs:
Start with
/api/
prefix.If bound to a specific resource,
/api/resource/{id}/
prefix is used.For the rest,
/api/component/{component}/
prefix is used.Use snake case (
/api/component/auth/current_user
for example).Collections must use singular forms and the trailing slash (
/api/resource/{id}/feature/
for features of resource).Collection items mustn’t use the trailing slash.
Static URLs:
Start with
/static/{static_key}/
prefix ({static_key}
is unique for each build and used for cache invalidation on caching proxies).
User URLs:
Use kebab case (
/control-panel
for example).Prefix
/resource/{id}/
is used if bound to a specific resource.
14.2.9.2. Route names
Pyramid route names:
Start with
{component}.
prefix.Use snake case (
pyramid.control_panel
for example).