Write a REST API Endpoint
Generate production-ready REST API endpoints with validation, error handling, and documentation.
๐ The Prompt
Create a REST API endpoint in [FRAMEWORK] for [RESOURCE].
Requirements:
- HTTP Method: [GET/POST/PUT/DELETE]
- Endpoint: /api/v1/[RESOURCE]
- Include input validation
- Proper error handling with HTTP status codes
- Authentication: [YES/NO]
- Database: [DATABASE TYPE]
Provide:
1. Route handler code
2. Data model/schema
3. Validation middleware
4. Example curl commands
5. Error response format
๐ก Tips for Better Results
Specify your framework (Express, FastAPI, Django, Spring Boot) for best practices.
๐ฏ Use Cases
Backend developers, full-stack developers, API prototyping, hackathons.
๐ Related Prompts
๐ป Coding
beginner
Explain Code Like Im a Beginner
Get any code explained in plain English with line-by-line breakdowns, analogies, and learning suggestions.
๐ป Coding
beginner
Debug My Code and Explain the Fix
Get your code debugged with clear explanations of what went wrong and why, plus the corrected version.
๐ป Coding
intermediate
Write Unit Tests for My Code
Generate thorough unit tests covering edge cases, error handling, and both positive and negative scenarios.
๐ป Coding
intermediate
Convert Code Between Languages
Convert code between any programming languages while maintaining idiomatic patterns and best practices.
๐ป Coding
advanced
Refactor Code for Better Performance
Get your code refactored for better performance with Big O analysis and design pattern suggestions.
๐ป Coding
advanced
Create a GitHub Actions CI/CD Workflow for Automated Testing and Deployment
Generate a complete GitHub Actions CI/CD workflow with build, test, deploy, and notification jobs for your project.