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:
@@ -38,9 +38,8 @@ pnpm dev
|
||||
|
||||
```typescript
|
||||
payloadFeatureFlags({
|
||||
enableRollouts: true, // Percentage rollouts
|
||||
enableRollouts: true, // Percentage rollouts
|
||||
enableVariants: true, // A/B testing
|
||||
enableApi: true, // REST endpoints
|
||||
defaultValue: false, // New flags start disabled
|
||||
// + custom fields and permissions
|
||||
})
|
||||
@@ -48,12 +47,17 @@ payloadFeatureFlags({
|
||||
|
||||
## API Testing
|
||||
|
||||
The plugin uses Payload's native REST API:
|
||||
|
||||
```bash
|
||||
# Get all flags
|
||||
curl http://localhost:3000/api/feature-flags
|
||||
|
||||
# Get specific flag
|
||||
curl http://localhost:3000/api/feature-flags/new-feature
|
||||
# Query specific flag
|
||||
curl 'http://localhost:3000/api/feature-flags?where[name][equals]=new-feature'
|
||||
|
||||
# Get only enabled flags
|
||||
curl 'http://localhost:3000/api/feature-flags?where[enabled][equals]=true'
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user