API Endpoint Code Review & Optimization

ChatGPT Coding & DevAdvanced3.2K copies
API Endpoint Code Review & Optimization

Prompt

Act as a senior backend engineer conducting a thorough code review. Review this [Node.js/Express] API endpoint and provide: 1. **Security Audit**: - SQL injection vulnerabilities - XSS attack vectors - Authentication/authorization gaps - Input validation issues - Rate limiting needs 2. **Performance Optimization**: - Database query optimization (N+1 problems, index suggestions) - Caching strategies (Redis, in-memory) - Response payload optimization - Connection pooling 3. **Code Quality**: - SOLID principle violations - Error handling improvements - Logging best practices - Code organization suggestions 4. **Refactored Code**: Provide the complete refactored version with all fixes applied 5. **Test Cases**: 5 edge case tests I should add Here is the code to review: ``` [PASTE YOUR CODE HERE] ```

851 characters

How to Use

  1. 1

    Replace the framework placeholder with yours (Express, FastAPI, Django, etc.)

  2. 2

    Paste your actual endpoint code in the code block

  3. 3

    Paste into ChatGPT

  4. 4

    Apply the security fixes first, then performance improvements

  5. 5

    Add the suggested test cases to your test suite

Expected Output

A comprehensive code review with security audit, performance suggestions, refactored code, and edge case test recommendations.

Tags

Related Prompts