Coding

REST API Builder

Describe what your API endpoint should do and get production-ready code with input validation, error handling, and proper status codes.

By The Prompt Black Magic Team

Copy the prompt, fill in the framework and endpoint details.

Write a REST API endpoint using [FRAMEWORK] that:

Endpoint: [METHOD] [PATH]
Purpose: [WHAT IT DOES]
Required fields: [LIST FIELDS]

The implementation should include:
1. Input validation for all fields with clear error messages
2. Proper HTTP status codes (200, 201, 400, 401, 404, 500)
3. Error handling with try-catch and meaningful responses
4. Request/response type definitions
5. Basic rate limiting or auth middleware placeholder
6. Example request and response payloads
7. Brief inline comments explaining the logic

Write clean, production-ready code that follows RESTful conventions.