mirror of
https://github.com/xtr-dev/payload-feature-flags.git
synced 2025-12-10 02:43:25 +00:00
Remove custom API endpoints in favor of Payload's native REST API
- Removed custom endpoint handler and endpoints directory - Removed enableApi configuration option from plugin - Updated client hooks to use Payload's native collection API - Updated documentation to reflect API changes - Updated view component to handle Payload API response format The plugin now uses Payload CMS's built-in REST API for the feature-flags collection, which provides standard query syntax, pagination, and automatic access control enforcement. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
10
CLAUDE.md
10
CLAUDE.md
@@ -56,10 +56,10 @@ The plugin follows Payload's plugin architecture with multiple exports:
|
||||
- `getUserVariant()`: A/B testing variant selection
|
||||
- `getFeatureFlagsByTag()`: Query flags by tags
|
||||
|
||||
#### API Endpoints (`src/endpoints/customEndpointHandler.ts`)
|
||||
- `GET /api/feature-flags` - List all active feature flags
|
||||
- `GET /api/feature-flags/:flag` - Get specific flag data
|
||||
- Only created when `enableApi: true`
|
||||
#### API Access
|
||||
- The plugin uses Payload's native REST API for the feature-flags collection
|
||||
- Standard Payload query syntax is supported
|
||||
- Collection access controls are enforced
|
||||
|
||||
### Collection Schema
|
||||
The plugin creates a feature flags collection with these key fields:
|
||||
@@ -93,9 +93,9 @@ The plugin integrates with Payload by:
|
||||
4. Supporting full collection customization through `collectionOverrides`
|
||||
|
||||
### Security Considerations
|
||||
- REST API endpoints are disabled by default (`enableApi: false`)
|
||||
- Server-side hooks are the preferred method for accessing feature flags
|
||||
- Collection access can be restricted through `collectionOverrides.access`
|
||||
- API access follows standard Payload authentication and authorization
|
||||
|
||||
### Testing Setup
|
||||
The development configuration (`dev/payload.config.ts`) includes:
|
||||
|
||||
Reference in New Issue
Block a user