{"id":22085134,"url":"https://github.com/d7omdev/personal-blog","last_synced_at":"2025-03-23T21:44:18.047Z","repository":{"id":230812928,"uuid":"780245047","full_name":"d7omdev/personal-blog","owner":"d7omdev","description":"A Personal Blog project Made with node.js","archived":false,"fork":false,"pushed_at":"2024-04-05T01:21:58.000Z","size":781,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T05:19:05.885Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CSS","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/d7omdev.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":"2024-04-01T03:55:42.000Z","updated_at":"2024-04-04T21:17:47.000Z","dependencies_parsed_at":"2024-04-01T05:26:59.523Z","dependency_job_id":"ac2ac675-8632-4034-bf83-6068d72b37f9","html_url":"https://github.com/d7omdev/personal-blog","commit_stats":null,"previous_names":["abdulrahmandev1/personal-blog","d7omdev/personal-blog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7omdev%2Fpersonal-blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7omdev%2Fpersonal-blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7omdev%2Fpersonal-blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d7omdev%2Fpersonal-blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d7omdev","download_url":"https://codeload.github.com/d7omdev/personal-blog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245175357,"owners_count":20572781,"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","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":"2024-12-01T01:11:47.778Z","updated_at":"2025-03-23T21:44:18.026Z","avatar_url":"https://github.com/d7omdev.png","language":"CSS","readme":"# API Documentation\n\nWelcome to the API Documentation for the Personal Blog project\n\n\u003cdetails\u003e\n\u003csummary\u003eNavigation\u003c/summary\u003e\n\n- [Authentication](#authentication)\n- [Endpoints](#endpoints)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Error Handling](#error-handling)\n- [Security](#security)\n- [Questions or Issues?](#questions-or-issues)\n\u003c/details\u003e\n\n## Overview\n\nthe API provides endpoints for managing categories, posts, and comments. It allows users to interact with the data by performing CRUD (Create, Read, Update, Delete) operations.\n\n## Base URL\n\n_not yet implemented_\n\nThe base URL for accessing the API is `https://api.example.com`.\n\n## Authentication\n\nAuthentication is required for certain endpoints. We use JSON Web Tokens (JWT) for authentication. To authenticate, include the JWT token in the `Authorization` header of your requests.\n\n### Authentication Routes\n\n- **POST /signup**: Create a new user account.\n- **POST /login**: Authenticate and generate a JWT token.\n- **POST /forgot-password**: Request to reset forgotten password.\n- **PATCH /reset-password/:token**: Reset password using the token received after forgot password request.\n- **PATCH /update-my-password**: Update Password For the current user\n\n_After signing up or logging in, the API will provide a JWT token, which should be included in the `Authorization` header for subsequent requests._\n\n\u003cdetails\u003e\n\u003csummary\u003eAuthentication Payloads\u003c/summary\u003e\n\n### 1. Signup\n\n- **Route**: POST /signup\n- **Description**: This route is used to create a new user account.\n\n```json\n{\n  \"name\": \"John Doe\",\n  \"email\": \"john@example.com\",\n  \"password\": \"password123\",\n  \"passwordConfirm\": \"password123\"\n}\n```\n\n### 2. Login\n\n- **Route**: POST /login\n- **Description**: This route is used to authenticate a user and generate a JWT token.\n\n```json\n{\n  \"email\": \"john@example.com\",\n  \"password\": \"password123\"\n}\n```\n\n### 3. Forgot Password\n\n- **Route**: POST /forgot-password\n- **Description**: This route is used to request to reset a forgotten password.\n\n```json\n{\n  \"email\": \"john@example.com\"\n}\n```\n\n### 4. Reset Password/:token\n\n- **Route**: PATCH /reset-password/:token\n- **Description**: This route is used to reset a password using the token received after forgot password request.\n\n```json\n{\n  \"password\": \"newpassword123\",\n  \"passwordConfirm\": \"newpassword123\"\n}\n```\n\n### 5. Update My Password\n\n- **Route**: PATCH /update-my-password\n- **Description**: This route is used to update the password for the current user. It is a protected route, meaning the user has to be logged in to access it.\n\n```json\n{\n  \"passwordCurrent\": \"oldpassword123\",\n  \"password\": \"newpassword123\",\n  \"passwordConfirm\": \"newpassword123\"\n}\n```\n\n\u003c/details\u003e\n\n## Endpoints\n\n### Categories\n\n- **GET /categories**: Retrieve all categories.\n- **POST /categories**: Create a new category.\n- **GET /categories/:id**: Retrieve a specific category by ID.\n- **PATCH /categories/:id**: Update a category.\n- **DELETE /categories/:id**: Delete a category.\n\n### Posts\n\n- **GET /posts**: Retrieve all posts.\n- **POST /posts**: Create a new post.\n- **GET /posts/:id**: Retrieve a specific post by ID.\n- **PATCH /posts/:id**: Update a post.\n- **DELETE /posts/:id**: Delete a post.\n\n### Comments\n\n- **GET /comments**: Retrieve all comments.\n- **POST /comments**: Create a new comment.\n- **GET /comments/:id**: Retrieve a specific comment by ID.\n- **PATCH /comments/:id**: Update a comment.\n- **DELETE /comments/:id**: Delete a comment.\n\n## Installation\n\n1. Clone the repository to your local machine:\n\n   ```bash\n   git clone https://github.com/abdulrahmanDev1/personal-blog.git\n   ```\n\n2. Navigate to the cloned repository directory:\n\n   ```bash\n   cd personal-blog\n   ```\n\n3. Create a `.env` file in the root directory of the project and fill it with your environment variables. You can use the provided `.env.example` file as a template:\n\n   ```bash\n   cp .env.example .env\n   ```\n\n   Fill in the necessary environment variables in the `.env` file.\n\n4. Install the necessary dependencies:\n\n   ```bash\n   npm install\n   ```\n\n5. Start the server:\n\n   ```bash\n   npm start\n   ```\n\n6. The server will start running at `http://localhost:3000` by default.\n\n## Usage\n\n### Creating a Category\n\nTo create a new category, send a POST request to `/categories` with the following JSON payload:\n\n```json\n{\n  \"name\": \"Category Name\"\n}\n```\n\n### Creating a Post\n\nTo create a new post, send a POST request to `/posts` with the following JSON payload:\n\n```json\n{\n  \"title\": \"Post Title\",\n  \"body\": \"Post Body\",\n  \"category\": \"Category ID\"\n}\n```\n\n### Creating a Comment\n\nTo create a new comment, send a POST request to `/comments` with the following JSON payload:\n\n```json\n{\n  \"body\": \"Comment Body\",\n  \"post\": \"Post ID\"\n}\n```\n\n## Error Handling\n\nThe API follows RESTful principles and returns appropriate HTTP status codes for each request. In case of errors, additional information will be provided in the response body.\n\n## Security\n\n### Rate Limiting\n\nTo prevent abuse and protect against DDoS attacks, the API implements rate limiting. Rate limiting restricts the number of requests a user can make within a certain time period.\n\nWe use the `express-rate-limit` middleware to implement rate limiting. The middleware is configured to allow a specified number of requests per minute. When the limit is exceeded, clients receive a `429 Too Many Requests` response.\n\n### Protection Against NoSQL Injection\n\nThe API is protected against NoSQL injection attacks using `express-mongo-sanitize`. This middleware sanitizes user-supplied data to prevent MongoDB query injection attacks. It removes prohibited characters from input strings before they are passed to MongoDB queries.\n\n## Questions or Issues?\n\nIf you have any questions or encounter any issues while using the API, please feel free to [raise an issue](https://github.com/abdulrahmanDev1/personal-blog/issues) in my GitHub repository.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd7omdev%2Fpersonal-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd7omdev%2Fpersonal-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd7omdev%2Fpersonal-blog/lists"}