-
Notifications
You must be signed in to change notification settings - Fork 0
Guidelines
NSpahic22 edited this page Oct 8, 2024
·
2 revisions
- Consistent Naming: Use PascalCase for classes, camelCase for variables.
- Keep Files Focused: Each file should serve a single purpose.
- Group Related Endpoints: Organize endpoints by resource type.
- Descriptive Names: Use clear names for functions, classes, and variables.
- Comment Wisely: Explain why, not what.
- Document APIs: Use Swagger for endpoint documentation.
- Meaningful Error Messages: Informative yet secure, use Microsoft.Aspnet.Result for errors.
- Avoid Sensitive Data in Errors: Don’t expose internal details.
- DRY Principle: Reuse code to avoid redundancy.
- Use Dependency Injection: Keep code modular and testable.
- Validate Input: Always validate user inputs.
- Use HTTPS: Encrypt data in transit.
- Implement Authentication/Authorization: Secure your endpoints.
- Asynchronous Calls: Use async/await for non-blocking tasks.
- Paginate Data: Avoid large payloads.
- Cache Repeated Calls: Cache frequently accessed data.
- Write Tests: Unit tests for logic, integration tests for endpoints.
- Use Logging: Log key actions for easier debugging.
- Descriptive Commits: Make commit messages meaningful.
- Use Feature Branches: Isolate new features and fixes.
- Code Reviews: Improve quality and team collaboration.