This project helped me gain a deeper understanding of building and optimizing APIs using ASP.NET Core. Below are the key concepts and techniques I learned while working through this project.
- Environment-Based Configuration: Learned how to manage
appsettings.jsonfor different environments (Development,Production) and use environment variables effectively. - Middleware Pipeline: Explored how middleware components process requests and responses and their importance in structuring the application pipeline.
- CORS Setup: Configured Cross-Origin Resource Sharing (CORS) to allow controlled access to APIs.
- Controllers and Routing: Built and managed routes to handle API endpoints efficiently.
- DTOs and AutoMapper: Differentiated between DTOs and entity models, and automated data mapping using AutoMapper.
- CRUD Operations: Implemented Create, Read, Update, and Delete (CRUD) functionalities with a structured approach.
- Built-in Attributes: Used attributes like
[Required],[MaxLength], and[Range]for input validation. - Custom Validation: Implemented custom attributes and the
IValidatableObjectinterface for complex validation scenarios.
- Custom Logger Service: Integrated a custom logging service using NLog for detailed log management.
- Log Levels: Utilized Info, Debug, Warn, and Error levels to monitor and debug the application.
- Onion Architecture: Applied the Onion Architecture to ensure separation of concerns and modular development.
- Repository Pattern: Built a generic repository for data access and encapsulated business logic in the service layer.
- Dependency Injection: Leveraged DI to manage services and promote loose coupling between components.
- Asynchronous Programming: Used
asyncandawaitfor non-blocking operations and improved application performance. - Action Filters: Implemented filters for cross-cutting concerns like validation and logging.
- Data Shaping: Customized API responses to include only requested data fields.
- Paging and Filtering: Implemented server-side paging and filtering for better data retrieval efficiency.
- Caching: Applied response and output caching to reduce server load and improve response times.
- Authentication and Authorization: Configured JWT authentication and role-based authorization.
- Refresh Tokens: Implemented refresh tokens for secure and persistent user sessions.
- API Documentation: Used Swagger to document and test API endpoints.
- Deployment: Configured the project for deployment to IIS with proper environment settings and SSL configuration.
- Developed a deeper understanding of API architecture and design patterns.
- Improved skills in creating scalable, maintainable, and secure APIs.
- Learned how to optimize APIs for performance and user experience.
This project provided a solid foundation for building professional-grade Web APIs in ASP.NET Core.