{"id":24283622,"url":"https://github.com/amreshpro/phoneapi","last_synced_at":"2025-09-09T23:13:08.730Z","repository":{"id":271439008,"uuid":"913441595","full_name":"amreshpro/phoneapi","owner":"amreshpro","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-07T18:19:48.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T04:17:30.846Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/amreshpro.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-01-07T17:31:48.000Z","updated_at":"2025-01-07T18:19:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"13204842-5f62-47f9-84c8-b880a6d97e15","html_url":"https://github.com/amreshpro/phoneapi","commit_stats":null,"previous_names":["amreshpro/phoneapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fphoneapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fphoneapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fphoneapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amreshpro%2Fphoneapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amreshpro","download_url":"https://codeload.github.com/amreshpro/phoneapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242058104,"owners_count":20065062,"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":"2025-01-16T04:17:27.675Z","updated_at":"2025-03-05T15:48:31.699Z","avatar_url":"https://github.com/amreshpro.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Here is a sample **README.md** file for your project:\n\n```markdown\n# Spam Marker API\n\nA simple API built with Express.js, TypeScript, and Mongoose to mark phone numbers as spam. This project demonstrates the implementation of authentication and basic CRUD operations with MongoDB.\n\n## Features\n\n- Mark phone numbers as spam.\n- Prevent duplicate spam entries for the same number.\n- JWT-based authentication for secure access.\n- Handles various error cases gracefully.\n\n---\n\n## Prerequisites\n\nMake sure you have the following installed:\n\n- Node.js (v16 or later)\n- MongoDB (local or cloud instance)\n- npm or yarn\n\n---\n\n## Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/amreshpro/phoneapi.git\n   cd spam-marker-api\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   # or\n   yarn install\n   ```\n\n3. Create a `.env` file in the root directory with the following variables:\n   ```env\n   PORT=5000\n   MONGO_URI=mongodb+srv://\u003cusername\u003e:\u003cpassword\u003e@cluster0.mongodb.net/dbName\n   JWT_SECRET=your_jwt_secret\n   ```\n\n---\n\n## Usage\n\n1. Start the server:\n   ```bash\n   npm start\n   # or\n   yarn start\n   ```\n\n2. The API will run at `http://localhost:5000`.\n\n---\n\n## Endpoints\n\n### 1. **Mark a Phone Number as Spam**\n   - **URL**: `/api/markSpam`\n   - **Method**: `POST`\n   - **Headers**:\n     - `Authorization: Bearer \u003cJWT_TOKEN\u003e`\n     - `Content-Type: application/json`\n   - **Body**:\n     ```json\n     {\n       \"phone\": \"1234567890\"\n     }\n     ```\n   - **Responses**:\n     - **201 Created**:\n       ```json\n       {\n         \"message\": \"Number marked as spam\",\n         \"spam\": {\n           \"_id\": \"123abc\",\n           \"phone\": \"1234567890\",\n           \"reportedBy\": \"user123\",\n           \"createdAt\": \"2025-01-01T12:00:00Z\",\n           \"updatedAt\": \"2025-01-01T12:00:00Z\"\n         }\n       }\n       ```\n     - **400 Bad Request**:\n       ```json\n       {\n         \"message\": \"This number is already marked as spam\"\n       }\n       ```\n     - **401 Unauthorized**:\n       ```json\n       {\n         \"message\": \"No token, authorization denied\"\n       }\n       ```\n\n---\n\n\n## Project Structure\n\n```plaintext\n.\n├── src\n│   ├── controllers\n│   │   └── contactController.ts  # Handles the business logic\n│   ├── middlewares\n│   │   └── authMiddleware.ts     # JWT authentication middleware\n│   ├── models\n│   │   └── Spam.ts               # Mongoose model for spam entries\n│   ├── routes\n│   │   └── contactRoutes.ts      # API routes\n│   ├── app.ts                    # Express app setup\n│   └── server.ts                 # Entry point for the server\n├── .env                          # Environment variables\n├── package.json                  # Project metadata and dependencies\n├── tsconfig.json                 # TypeScript configuration\n└── README.md                     # Project documentation\n```\n\n---\n\n## Technologies Used\n\n- **Backend**: Node.js, Express.js\n- **Database**: MongoDB (Mongoose ODM)\n- **Language**: TypeScript\n- **Authentication**: JSON Web Tokens (JWT)\n\n---\n\n## Contact\n\n- **Author**: Amresh Maurya\n- **GitHub**: [amreshpro](https://github.com/amreshpro)\n- **Email**: amresh.terminal@gmail.com\n```\n\nYou can customize this further with your specific details or requirements. Let me know if you need any changes!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famreshpro%2Fphoneapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famreshpro%2Fphoneapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famreshpro%2Fphoneapi/lists"}