docs: update documentation for platform-aware storefront routing

Update 8 documentation files to reflect new URL scheme:
- Dev: /platforms/{code}/storefront/{store_code}/
- Prod: subdomain.platform.lu/ (root path = storefront)
- Rename DEFAULT_PLATFORM_CODE to MAIN_PLATFORM_CODE
- Replace hardcoded platform_id=1 with dynamic values
- Update route examples, middleware descriptions, code samples

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-23 23:56:26 +01:00
parent 32acc76b49
commit 272b62fbd3
8 changed files with 126 additions and 118 deletions

View File

@@ -24,16 +24,16 @@ The Storefront API provides customer-facing endpoints for browsing products, man
All Storefront API endpoints automatically receive store context from the `StoreContextMiddleware`:
1. **Browser makes API call** from storefront page (e.g., `/stores/orion/storefront/products`)
2. **Browser automatically sends Referer header**: `http://localhost:8000/stores/orion/storefront/products`
1. **Browser makes API call** from storefront page (e.g., `/platforms/oms/storefront/ORION/products`)
2. **Browser automatically sends Referer header**: `http://localhost:8000/platforms/oms/storefront/ORION/products`
3. **Middleware extracts store** from Referer path/subdomain/domain
4. **Middleware sets** `request.state.store = <Store: orion>`
4. **Middleware sets** `request.state.store = <Store: ORION>`
5. **API endpoint accesses store**: `store = request.state.store`
6. **No store_id needed in URL!**
### Supported Store Detection Methods
- **Path-based**: `/stores/orion/storefront/products` → extracts `orion`
- **Path-based (dev)**: `/platforms/oms/storefront/ORION/products` → extracts `ORION`
- **Subdomain**: `orion.platform.com` → extracts `orion`
- **Custom domain**: `customshop.com` → looks up store by domain