Implement efficient API pagination with cursor or offset-based approaches
Implement pagination for my API: API Type: [REST/GraphQL] Framework: [EXPRESS/FASTAPI/etc.] Database: [PostgreSQL/MongoDB/etc.] Data Volume: [ROWS/DOCUMENTS COUNT] Requirements: - Sorting options: [LIST SORTABLE FIELDS] - Filtering: [YES/NO] - Real-time data: [YES/NO - items added frequently] - Client needs: [INFINITE SCROLL/PAGE NUMBERS/BOTH] Please provide: 1. Pagination approach recommendation (cursor vs. offset) 2. Complete implementation code 3. API request/response format 4. Database query optimization 5. Handling edge cases (deleted items, sorting changes) 6. Performance comparison and recommendations
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[LIST SORTABLE FIELDS]