{"id":18331813,"url":"https://github.com/pixelrocket-shop/tutorials-api-newsletter","last_synced_at":"2025-04-09T18:29:26.142Z","repository":{"id":250480485,"uuid":"834568943","full_name":"PixelRocket-Shop/tutorials-api-newsletter","owner":"PixelRocket-Shop","description":"The public dummy API used for newsletter functionality in my tutorials, courses and projects","archived":false,"fork":false,"pushed_at":"2024-07-28T06:15:31.000Z","size":2578,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-15T11:16:21.633Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://tutorials-api-newsletter.vercel.app","language":"JavaScript","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/PixelRocket-Shop.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-07-27T17:04:23.000Z","updated_at":"2024-07-28T06:15:34.000Z","dependencies_parsed_at":"2024-07-27T19:13:27.955Z","dependency_job_id":"020c9108-c9ff-4dcd-8454-a507f0d8b96e","html_url":"https://github.com/PixelRocket-Shop/tutorials-api-newsletter","commit_stats":null,"previous_names":["pixelrocket-shop/tutorials-api-newsletter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelRocket-Shop%2Ftutorials-api-newsletter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelRocket-Shop%2Ftutorials-api-newsletter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelRocket-Shop%2Ftutorials-api-newsletter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PixelRocket-Shop%2Ftutorials-api-newsletter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PixelRocket-Shop","download_url":"https://codeload.github.com/PixelRocket-Shop/tutorials-api-newsletter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248087331,"owners_count":21045505,"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-11-05T19:35:21.723Z","updated_at":"2025-04-09T18:29:26.123Z","avatar_url":"https://github.com/PixelRocket-Shop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Newsletter API\n\nThis project is a simple Newsletter API built with Express.js, featuring rate limiting and Swagger documentation. The API allows users to sign up for a newsletter, check if an email is subscribed, and unsubscribe. The subscribers are stored in a JSON file. This API is used in my tutorials, courses, and projects on [pixelrocket.store](https://www.pixelrocket.store).\n\n## Features\n\n- **Rate Limiting:** Prevents abuse by limiting the number of requests per IP address.\n- **Swagger Documentation:** Provides a user-friendly interface to interact with the API.\n- **JSON File Storage:** Subscriber data is stored in a JSON file for simplicity.\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js and npm installed on your machine.\n- Vercel CLI for deployment (optional).\n\n### Installation\n\n1. Clone the repository:\n   git clone https://github.com/PixelRocket-Shop/tutorials-api-newsletter.git\n   \\\n   cd newsletter-api\n   \n\n2. Install dependencies:\n   npm install\n   \n\n### Running the API Locally\n\n1. Start the server:\n   node src/app.js\n   \n\n2. The API will be running at http://localhost:3000.\n\n3. Access the Swagger documentation at http://localhost:3000/api-docs.\n\n### API Endpoints\n\n#### Sign Up for Newsletter\n\n- **URL:** /newsletter\n- **Method:** POST\n- **Request Body:**\n  json\n  {\n    \"email\": \"user@example.com\"\n  }\n  \n- **Responses:**\n  - 200 OK: Successfully signed up.\n  - 400 Bad Request: Email already subscribed.\n\n#### Unsubscribe from Newsletter\n\n- **URL:** /newsletter/{email}\n- **Method:** DELETE\n- **Parameters:**\n  - email (string): The email to unsubscribe.\n- **Responses:**\n  - 200 OK: Successfully unsubscribed.\n  - 404 Not Found: Email not found.\n\n#### Check if Email is Subscribed\n\n- **URL:** /newsletter/{email}\n- **Method:** GET\n- **Parameters:**\n  - email (string): The email to check.\n- **Responses:**\n  - 200 OK: Email is subscribed.\n  - 404 Not Found: Email not subscribed.\n\n\n### License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixelrocket-shop%2Ftutorials-api-newsletter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixelrocket-shop%2Ftutorials-api-newsletter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixelrocket-shop%2Ftutorials-api-newsletter/lists"}