Generate a complete API endpoint with validation, auth, error handling, and example payloads — ready to drop into your codebase.
R
Ralphable
·Apr 30, 2026·
198 312 2,400
$7.99
Prompt
102 words
Design a production-ready [REST/GraphQL] API endpoint for the following operation: [DESCRIBE OPERATION, e.g., "Fetch a user's order history with pagination and filtering"].
Use [FRAMEWORK, e.g., Express.js, Django REST, Spring Boot, Next.js API Routes].
Provide:
1. The complete route/query/mutation definition with HTTP method
2. Request validation schema (use Zod, Joi, or framework-native validation)
3. The controller function with:
- Input validation and sanitization
- Authentication/authorization check
- Database query with proper error handling
- Response formatting
4. Example request and response payloads (JSON format)
5. Error response format for 400, 401, 403, 404, and 500 cases
6. Rate limiting recommendation for this endpoint
Describe the operation, specify your framework, and mention any auth patterns you use. The output includes everything from route definition to error handling.