This is a hands-on project for learning .NET API development, aimed at creating the backend for a Library Management System. 🚀
Before running the application, make sure to set the environment variables for sensitive credentials.
-
Ensure you're in a BASH terminal.
-
Run the shell script to set the environment variables:
source Deployment/set_env_vars.sh
Before running the application, you need to import the provided database dump.
- Ensure you have MySQL installed and running on your machine.
- Navigate to the
Database
folder where the dump file is located. - Run the following command to import the database dump:
Replace
mysql -u [username] -p [database_name] < Database/dump.sql
[username]
with your MySQL username and[database_name]
with the name of the database you want to create or use.
Once the environment variables are set and the database is imported, you can run the application.
- To run the application with HTTPS:
dotnet run --launch-profile https
- To run the application with hot reload:
dotnet watch
After running the application, you can access the Swagger documentation to explore and test the API endpoints.
- Open your web browser and navigate to: http://localhost:5114/swagger
To run the application with the specified launch profile (e.g., HTTPS):
dotnet run --launch-profile https
To start the application with hot reload (automatically reload changes without restarting the app):
dotnet watch
To see all the installed .NET SDK versions on your machine:
dotnet --list-sdks
To list all the packages currently being used in the project:
dotnet list package
To create a .gitignore file with default settings suitable for .NET projects:
dotnet new gitignore
- ☑︎ Versioning
- Supports URL segment versioning (e.g.,
api/v1.0/User
)
- Supports URL segment versioning (e.g.,
- ☑︎ ORM for MySQL
- Using the
EntityFrameworkCore
to interact with theMySQL
database.
- Using the
- ☑︎ Basic CRUD operations
- ☑︎ Centralized exception handling
- Using the
Middleware
to streamline error handling across the application.
- Using the
- ☑︎ Sensitive credentials management
- Storing credentials securely with the
Environment Variables
.
- Storing credentials securely with the
- ☑︎ Authentication and Authorization
- Authentication is implemented using
Auth0
as theOAuth2
client.Scope-based authorization
is enforced via endpoint-specificdecorators
. For more details, refer to the documentation: Auth0 Quickstart for ASP.NET Core Web API.
- Authentication is implemented using
- ☑︎ Input Validation
- Validating request bodies with the
FluentValidation
library.
- Validating request bodies with the
- ☑︎ API Response Customization and Optimization
- Using
query parameters
to customize and optimize API responses, such as controlling the inclusion of related data.
- Using
- ☐ Pagination and Filtering
- ☐ Logging and Monitoring
- ☐ Unit Testing
- ☑︎ API Documentation
- Uses
Swashbuckle
to generate Swagger UI for exploring and testing API endpoints with versioning and JWT authentication.
- Uses
- ☐ Database Migration
- ☐ Resilience and Fault Tolerance
- Implemented using
Polly
for strategies like retries, circuit breakers, and fallback policies.
- Implemented using
Happy coding! 😊