{"id":24373351,"url":"https://github.com/wildanazz/commentapi","last_synced_at":"2025-09-01T03:34:51.487Z","repository":{"id":242850732,"uuid":"810745814","full_name":"wildanazz/CommentApi","owner":"wildanazz","description":"A Web API that performs CRUD operations on a MongoDB database for the comment section of my personal website.","archived":false,"fork":false,"pushed_at":"2025-01-07T10:40:45.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T11:16:06.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://wildanazz.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wildanazz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-06-05T09:25:32.000Z","updated_at":"2025-01-07T10:40:49.000Z","dependencies_parsed_at":"2024-06-05T10:48:49.785Z","dependency_job_id":"64617316-0674-4a06-857d-88dd4a3364e7","html_url":"https://github.com/wildanazz/CommentApi","commit_stats":null,"previous_names":["wildanazz/commentapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wildanazz/CommentApi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildanazz%2FCommentApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildanazz%2FCommentApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildanazz%2FCommentApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildanazz%2FCommentApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wildanazz","download_url":"https://codeload.github.com/wildanazz/CommentApi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wildanazz%2FCommentApi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273069751,"owners_count":25040113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-01-19T05:10:51.123Z","updated_at":"2025-09-01T03:34:51.458Z","avatar_url":"https://github.com/wildanazz.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\n\n# CommentApi\n\nA Web API built using .NET Core to handle CRUD operations on a MongoDB database for managing the comment section of a personal website. The API provides endpoints for creating, retrieving, updating, and deleting user comments.\n\n## Features\n\n- **RESTful API**: Provides clear, structured endpoints for CRUD operations on comments.\n- **MongoDB Integration**: Uses MongoDB for persistent comment storage.\n- **Validation**: Basic input validation for comment fields.\n- **Error Handling**: Returns appropriate HTTP status codes for success, errors, and edge cases.\n- **Dockerized**: Easily deployable through Docker.\n  \n## Endpoints\n\n### 1. GET /comments\nRetrieves all comments from the database.\n- Example Response:\n  ```json\n  [\n    {\n      \"id\": \"1\",\n      \"username\": \"user123\",\n      \"message\": \"This is a test comment.\",\n      \"createdAt\": \"2024-09-30T12:00:00Z\"\n    }\n  ]\n  ```\n\n### 2. GET /comments/{id}\nRetrieves a specific comment by ID.\n- Example Response:\n  ```json\n  {\n    \"id\": \"1\",\n    \"username\": \"user123\",\n    \"message\": \"This is a test comment.\",\n    \"createdAt\": \"2024-09-30T12:00:00Z\"\n  }\n  ```\n\n### 3. POST /comments\nAdds a new comment.\n- Example Request:\n  ```json\n  {\n    \"username\": \"user123\",\n    \"message\": \"Great post!\"\n  }\n  ```\n- Example Response:\n  ```json\n  {\n    \"id\": \"2\",\n    \"username\": \"user123\",\n    \"message\": \"Great post!\",\n    \"createdAt\": \"2024-09-30T12:10:00Z\"\n  }\n  ```\n\n### 4. PUT /comments/{id}\nUpdates an existing comment by ID.\n- Example Request:\n  ```json\n  {\n    \"message\": \"Updated comment text.\"\n  }\n  ```\n- Example Response:\n  ```json\n  {\n    \"id\": \"1\",\n    \"username\": \"user123\",\n    \"message\": \"Updated comment text.\",\n    \"createdAt\": \"2024-09-30T12:00:00Z\",\n    \"updatedAt\": \"2024-09-30T12:15:00Z\"\n  }\n  ```\n\n### 5. DELETE /comments/{id}\nDeletes a specific comment by ID.\n- Example Response:\n  ```json\n  {\n    \"message\": \"Comment deleted successfully.\"\n  }\n  ```\n\n## Getting Started\n\n### Prerequisites\n\n- .NET Core 3.1 SDK or higher\n- MongoDB (local or remote instance)\n- Docker (optional for containerization)\n\n### Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/wildanazz/CommentApi.git\n   cd CommentApi\n   ```\n\n2. Restore packages:\n   ```bash\n   dotnet restore\n   ```\n\n3. Set up MongoDB:\n   - Ensure MongoDB is running locally or provide a connection string to a remote MongoDB instance in `appsettings.json`.\n   - Modify the `ConnectionStrings:DefaultConnection` to match your MongoDB instance.\n\n4. Build and run the application:\n   ```bash\n   dotnet run\n   ```\n\n   The application will start at `http://localhost:5000`.\n\n### Running with Docker\n\n1. Build the Docker image:\n   ```bash\n   docker build -t comment-api .\n   ```\n\n2. Run the Docker container:\n   ```bash\n   docker run -d -p 5000:5000 --name comment-api comment-api\n   ```\n\n3. The API will be accessible at `http://localhost:5000`.\n\n## Configuration\n\n- The main configuration file is `appsettings.json` where you can configure MongoDB connection strings and other environment-specific settings.\n- For development configurations, you can use `appsettings.Development.json`.\n\n## Todo\n\n- Add reCAPTCHA middleware.\n- Create endpoint for comment section on each article.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildanazz%2Fcommentapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwildanazz%2Fcommentapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwildanazz%2Fcommentapi/lists"}