{"id":15110081,"url":"https://github.com/fattahsamit/crud-backend","last_synced_at":"2026-01-18T20:32:50.061Z","repository":{"id":255696540,"uuid":"852791849","full_name":"fattahsamit/crud-backend","owner":"fattahsamit","description":"CRUD Backend","archived":false,"fork":false,"pushed_at":"2024-09-07T10:26:04.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T16:33:57.902Z","etag":null,"topics":["backend","crud","express","mongodb","mongoose","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/fattahsamit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-09-05T12:39:47.000Z","updated_at":"2024-09-07T10:26:08.000Z","dependencies_parsed_at":"2024-09-06T19:27:00.237Z","dependency_job_id":"141002c9-4a5e-410d-8a29-f4108519610b","html_url":"https://github.com/fattahsamit/crud-backend","commit_stats":null,"previous_names":["fattahsamit/products-crud-backend","fattahsamit/crud-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fattahsamit/crud-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahsamit%2Fcrud-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahsamit%2Fcrud-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahsamit%2Fcrud-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahsamit%2Fcrud-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fattahsamit","download_url":"https://codeload.github.com/fattahsamit/crud-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahsamit%2Fcrud-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28549833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T19:56:05.265Z","status":"ssl_error","status_checked_at":"2026-01-18T19:55:54.685Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["backend","crud","express","mongodb","mongoose","nodejs"],"created_at":"2024-09-25T23:40:43.975Z","updated_at":"2026-01-18T20:32:50.043Z","avatar_url":"https://github.com/fattahsamit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CRUD-Backend\n\n## Overview\n\nThis project is a simple CRUD (Create, Read, Update, Delete) API built with Express.js and MongoDB using Mongoose for data modeling. The application allows you to perform basic operations on a `Product` resource.\n\n## Features\n\n- **Create**: Add new products to the database.\n- **Read**: Retrieve a list of all products or get details of a specific product by ID.\n- **Update**: Modify details of an existing product by ID.\n- **Delete**: Remove a product from the database by ID.\n\n## Technologies\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://skillicons.dev/icons?i=nodejs,express,mongodb,postman\" /\u003e\n\u003c/p\u003e\n\n- **Express.js**: Web framework for Node.js.\n- **MongoDB**: NoSQL database for storing data.\n- **Mongoose**: ODM (Object Data Modeling) library for MongoDB and Node.js.\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js and npm installed on your machine.\n- MongoDB database (either local or MongoDB Atlas).\n\n### Installation\n\n1. **Clone the repository**:\n\n   ```bash\n   git clone https://github.com/fattahsamit/products-crud-backend.git\n   ```\n\n2. **Navigate to the project directory**:\n   ```bash\n   cd crud-app\n   ```\n3. **Install dependencies**:\n   ```bash\n   npm install\n   ```\n4. **Create a .env file in the root directory of the project and add your MongoDB connection details**:\n   ```bash\n   PORT=8000\n   DB_USERNAME=mongodb-username\n   DB_PASSWORD=mongodb-password\n   ```\n\n### Running the Application\n\n1. **Start the server**:\n\n   ```bash\n   npm start\n   ```\n\n2. **Run the server in development mode with auto-reloading**:\n\n   ```bash\n   npm run dev\n   ```\n\n## API Endpoints\n\n- **\u003cspan style=\"color: lightgreen;\"\u003eGET\u003c/span\u003e /api/products**: Retrieve all products. Optionally, add a limit query parameter to limit the number of results.\n- **\u003cspan style=\"color: lightgreen;\"\u003eGET\u003c/span\u003e /api/products/:id**: Retrieve a single product by ID.\n- **\u003cspan style=\"color: yellow;\"\u003ePOST\u003c/span\u003e /api/products**: Create a new product. Requires a JSON body with product details.\n- **\u003cspan style=\"color: skyblue;\"\u003ePUT\u003c/span\u003e /api/products/:id**: Update an existing product by ID. Requires a JSON body with updated product details.\n- **\u003cspan style=\"color: red;\"\u003eDELETE\u003c/span\u003e /api/products/:id**: Update an existing product by ID. Requires a JSON body with updated product details.\n\n## Testing\n\n### Import Postman Collection\n\nTo test the API endpoints with Postman, you can use the provided Postman collection. Follow these steps to import the collection:\n\n1. Open Postman\n2. Import the [Postman Collection](https://www.postman.com/universal-zodiac-887192/workspace/showcase/collection/28308550-c7fa793f-1708-48ee-b1bc-51b19db87a5b?action=share\u0026creator=28308550), use the `JSON` file provided in the testing folder\n3. Use the Collection:\n   - Once imported, you will find the collection in the left sidebar under Collections.\n   - Expand the collection to see the available requests.\n   - Click on a request to view and send it.\n   - Modify the request details if needed (e.g., change the endpoint URL or add query parameters).\n\n### Example Requests in Postman\n\nTo test the API endpoints with Postman, you can use the provided Postman collection. Follow these step\n\n- Get All Products with a Limit:\n\n  - Select the **GET** request for **/api/products**.\n  - Add a query parameter **limit** with a value (e.g. 5).\n  - Click **Send** to see the response.\n\n- Post a New Product:\n\n  - Select the **POST** request for **/api/products**.\n  - In the **Body** tab, select **raw** and choose **JSON** from the dropdown.\n  - Enter the product details in **JSON** format, for example:\n\n  ```bash\n   {\n  \"name\": \"New Product\",\n  \"quantity\": 15,\n  \"price\": 120\n  }\n  ```\n\n  - Click **Send** to create the new product.\n\n### Automated Testing with Postman\n\nYou can add test scripts in Postman to automatically validate responses. Here is an example of test scripts that you can include in Postman for automated testing of API responses:\n\n**Example Test Scripts:**\n\n- Test for **POST /api/products**:\n\n```bash\npm.test(\"Status code is 201\", () =\u003e {\n    pm.response.to.have.status(201);\n});\n\nconst response = pm.response.json();\nconst product = response._id;\npm.collectionVariables.set(\"product\", product);\n```\n\n**Running Tests in Postman:**\n\n1. Test scripts are already added. Data can be modified, click the `Send` button on any request, and Postman will automatically run the tests after receiving a response.\n2. The results of the tests will be displayed under the `Tests` tab of the response panel.\n\n## License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](https://github.com/fattahsamit/products-crud-backend/blob/main/LICENSE) file for details.\n\n## Future Implementations\n\n1. **Search**: Enable keyword search for products.\n2. **Sorting**: Implement sorting by attributes like price or name.\n3. **Rate Limiting**: Prevent abuse with rate limiting.\n4. **Caching**: Use caching to improve performance and reduce database load.\n5. **API Documentation**: Provide interactive API documentation with Swagger.\n\n## Author\n\nFattah Samit - https://github.com/fattahsamit\n\nThis `README.md` provides a comprehensive overview of your project, installation steps, usage instructions, and additional details to help users get started with your CRUD application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffattahsamit%2Fcrud-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffattahsamit%2Fcrud-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffattahsamit%2Fcrud-backend/lists"}