{"id":28102560,"url":"https://github.com/adilrifaie/asp-dotnet-web-api","last_synced_at":"2026-02-11T11:33:03.565Z","repository":{"id":277342609,"uuid":"932090675","full_name":"adilrifaie/asp-dotnet-web-api","owner":"adilrifaie","description":"Web API project is here!","archived":false,"fork":false,"pushed_at":"2025-02-13T12:00:17.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T21:46:35.611Z","etag":null,"topics":["asp-net-core","csharp","oop","webapi","website"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adilrifaie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-13T10:53:16.000Z","updated_at":"2025-03-14T15:06:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"fffb9643-2703-47e4-9b5a-a3845878ab09","html_url":"https://github.com/adilrifaie/asp-dotnet-web-api","commit_stats":null,"previous_names":["tohpakang98/asp-dotnet-web-api","adilrifaie/asp-dotnet-web-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adilrifaie/asp-dotnet-web-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adilrifaie%2Fasp-dotnet-web-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adilrifaie%2Fasp-dotnet-web-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adilrifaie%2Fasp-dotnet-web-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adilrifaie%2Fasp-dotnet-web-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adilrifaie","download_url":"https://codeload.github.com/adilrifaie/asp-dotnet-web-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adilrifaie%2Fasp-dotnet-web-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29332573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T06:13:03.264Z","status":"ssl_error","status_checked_at":"2026-02-11T06:12:55.843Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","csharp","oop","webapi","website"],"created_at":"2025-05-13T19:56:17.185Z","updated_at":"2026-02-11T11:33:03.538Z","avatar_url":"https://github.com/adilrifaie.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"During my 3rd Semester, I've learn about Object-Oriented Programming(OOP). All of the pillars of OOP have been applied in this project and also some addition about Application Programming Interface (API). So here we go :)\n\n### Project Overview\n- **Title**: Book Management API\n- **Description**: A RESTful API for managing books, including CRUD operations, user authentication, and authorization. Built with ASP.NET Core, Entity Framework Core, and Identity for user management.\n\n### Features\n- **Book Management**:\n  - **Get All Books**: Retrieve a list of all books.\n  - **Get Book by ID**: Retrieve a specific book by its ID.\n  - **Add Book**: Add a new book (Admin role required).\n  - **Update Book**: Update an existing book (User role required).\n  - **Delete Book**: Delete a book by its ID (Admin role required).\n  - **Search Books**: Search books by title.\n\n- **User Authentication and Authorization**:\n  - **User Registration**: Register a new user.\n  - **User Login**: Authenticate and generate a JWT token.\n  - **Token Refresh**: Refresh an expired JWT token.\n\n### Technologies Used\n- **Backend**: ASP.NET Core\n- **Database**: SQLite with Entity Framework Core\n- **Authentication**: ASP.NET Core Identity with JWT (JSON Web Tokens)\n- **Dependency Injection**: Built-in ASP.NET Core DI\n- **AutoMapper**: For object-to-object mapping\n- **Swagger**: API documentation and testing\n\n### Setup and Installation\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/TohPakAng98/asp-dotnet-web-api.git\n   cd asp-dotnet-web-api\n   ```\n\n2. **Install Dependencies**:\n   ```bash\n   dotnet restore\n   ```\n\n3. **Database Setup**:\n   - Ensure SQLite is installed.\n   - Update the connection string in `appsettings.json`.\n   - Run migrations to create the database:\n     ```bash\n     dotnet ef database update\n     ```\n\n4. **Run the Application**:\n   ```bash\n   dotnet run\n   ```\n\n5. **Access Swagger UI**:\n   - Navigate to `https://localhost:5001/swagger` to explore the API endpoints.\n\n### API Endpoints\n- **Books**:\n  - `GET /api/books`: Get all books.\n  - `GET /api/books/{id}`: Get a book by ID.\n  - `POST /api/books`: Add a new book.\n  - `PUT /api/books/{id}`: Update a book.\n  - `DELETE /api/books/{id}`: Delete a book.\n  - `GET /api/books/search`: Search books by title.\n\n- **Authentication**:\n  - `POST /api/auth`: Register a new user.\n  - `POST /api/login`: Authenticate and get a JWT token.\n  - `POST /api/refresh`: Refresh an expired JWT token.\n\n### Error Handling\n- Custom exception handling middleware is implemented to return consistent error responses.\n- Common HTTP status codes:\n  - `200 OK`: Successful request.\n  - `201 Created`: Resource created successfully.\n  - `204 No Content`: Successful request with no content to return.\n  - `400 Bad Request`: Invalid request data.\n  - `401 Unauthorized`: Authentication required.\n  - `404 Not Found`: Resource not found.\n  - `422 Unprocessable Entity`: Validation errors.\n\n### Security\n- **Authentication**: JWT-based authentication.\n- **Authorization**: Role-based access control (Admin, User).\n- **CORS**: Configured to allow cross-origin requests.\n\n### Contributing\n- Contributions are welcome! Please fork the repository and submit a pull request.\n\n### License\n- This project is licensed under the MIT License. See the `LICENSE` file for details.\n\n### Acknowledgments\n- Thanks to the ASP.NET Core team for the excellent framework and tools.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadilrifaie%2Fasp-dotnet-web-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadilrifaie%2Fasp-dotnet-web-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadilrifaie%2Fasp-dotnet-web-api/lists"}