PromptsVault AI is thinking...
Searching the best prompts from our community
Searching the best prompts from our community
Prompts matching the #backend tag
Design clean RESTful APIs. Principles: 1. Use nouns for resources (/users, not /getUsers). 2. HTTP methods: GET (read), POST (create), PUT (update), DELETE (delete). 3. Proper status codes (200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Server Error). 4. Versioning (/v1/users). 5. Filtering, sorting, pagination (?page=2&sort=name). 6. HATEOAS (include links to related resources). 7. Consistent naming (camelCase or snake_case). Use JSON. Stateless requests. Authentication with JWT/OAuth. Rate limiting. Comprehensive documentation (OpenAPI/Swagger). Error messages should be helpful.
Design intuitive REST APIs. Guidelines: 1. Noun-based resource URLs. 2. HTTP methods correctly (GET, POST, PUT, DELETE, PATCH). 3. Proper status codes (200, 201, 400, 404, 500). 4. Versioning strategy (/v1/). 5. Pagination for large collections. 6. Filtering, sorting, searching. 7. HATEOAS for discoverability. 8. Consistent error format. Use JSON. Document with OpenAPI/Swagger. Implement rate limiting.
Design scalable GraphQL schemas. Patterns: 1. Types for domain models. 2. Queries for reads, mutations for writes. 3. Input types for complex arguments. 4. Interfaces and unions for polymorphism. 5. Connection pattern for pagination. 6. DataLoader for N+1 prevention. 7. Directive for custom logic. 8. Federation for microservices. Use schema-first approach. Implement authorization at field level.
I need to design a RESTful API for a social media application. The resources are Users, Posts, Comments, and Likes. Design the endpoints, including HTTP methods, URL structure, and request/response payloads. Provide examples for creating a new post and fetching comments for a post.
Design a GraphQL schema for a blog application. The schema should define types for Author, Post, and Comment. Include queries to fetch all posts, a single post by ID, and all posts by a specific author. Also, include mutations for creating a new comment.