Register Missing Backend API Routes
Several endpoints needed by the Angular frontend do not exist in the backend. These need to be registered to make existing frontend pages functional.
Endpoints to Create
1. Batch Key Insert
POST /keys/batch
Content-Type: application/json
Body: { "records": [{ "key": "k1", "value": "v1" }, ...] }
Response: { "status": "ok", "inserted": 42 }
- Uses existing
Engine::put_cf in a loop (or WAL group commit if available)
- Must respect rate limits and auth
2. Search Keys
GET /keys/search?q={query}&prefix={bool}&cursor={str}&limit={n}
Response: { "keys": [...], "cursor": "..." }
- When
prefix=true: delegate to Engine::search_prefix
- When
prefix=false: substring match (scan + filter)
- Cursor-based pagination
3. Full Scan
GET /scan?limit={n}&cursor={str}
Response: { "records": [{ "key": "...", "value": "..." }], "cursor": "..." }
- Delegates to
Engine::scan_cf("default", None, None, Some(limit))
4. POST /keys (alternative to PUT)
POST /keys
Content-Type: application/json
Body: { "key": "mykey", "value": "myvalue" }
Response: { "status": "ok" }
- Convenience wrapper, same as
PUT /keys/{key}
5. Feature Flags API
GET /features — List all feature flags
POST /features/{name} — Create/update a feature flag
DELETE /features/{name} — Delete a feature flag
- The
src/features/ module exists but is a placeholder
- Create proper feature flag storage and API
6. Token Management API
GET /admin/tokens — List all tokens (with metadata)
POST /admin/tokens — Create a new token
DELETE /admin/tokens/{id} — Revoke a token
TokenManager in src/api/auth/manager.rs exists but has no REST routes
- Wire up the existing token CRUD methods to HTTP handlers
Implementation Notes
- All endpoints must use existing auth middleware (
HttpAuthentication::bearer)
- All endpoints must respect rate limiting
- Follow existing patterns in
src/api/mod.rs
- Add proper error handling and status codes
- Write integration tests for each new endpoint
Acceptance Criteria
Parent Epic
#290
Register Missing Backend API Routes
Several endpoints needed by the Angular frontend do not exist in the backend. These need to be registered to make existing frontend pages functional.
Endpoints to Create
1. Batch Key Insert
Engine::put_cfin a loop (or WAL group commit if available)2. Search Keys
prefix=true: delegate toEngine::search_prefixprefix=false: substring match (scan + filter)3. Full Scan
Engine::scan_cf("default", None, None, Some(limit))4. POST /keys (alternative to PUT)
PUT /keys/{key}5. Feature Flags API
src/features/module exists but is a placeholder6. Token Management API
TokenManagerinsrc/api/auth/manager.rsexists but has no REST routesImplementation Notes
HttpAuthentication::bearer)src/api/mod.rsAcceptance Criteria
POST /keys/batchworks with valid and invalid recordsGET /keys/search?q=returns matching keys with paginationGET /scanreturns all key-value pairsPOST /keysworks as alternative to PUTParent Epic
#290