{"id":22621495,"url":"https://github.com/experiencedeveloper/edu-crud-api","last_synced_at":"2025-03-29T02:24:37.924Z","repository":{"id":267112424,"uuid":"900287660","full_name":"Experiencedeveloper/Edu-CRUD-API","owner":"Experiencedeveloper","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-09T10:31:33.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-03T12:35:30.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Experiencedeveloper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-12-08T11:50:29.000Z","updated_at":"2024-12-09T10:31:37.000Z","dependencies_parsed_at":"2024-12-08T13:28:59.597Z","dependency_job_id":null,"html_url":"https://github.com/Experiencedeveloper/Edu-CRUD-API","commit_stats":null,"previous_names":["experiencedeveloper/edu-crud-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Experiencedeveloper%2FEdu-CRUD-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Experiencedeveloper%2FEdu-CRUD-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Experiencedeveloper%2FEdu-CRUD-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Experiencedeveloper%2FEdu-CRUD-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Experiencedeveloper","download_url":"https://codeload.github.com/Experiencedeveloper/Edu-CRUD-API/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246127815,"owners_count":20727794,"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-08T23:09:38.691Z","updated_at":"2025-03-29T02:24:37.909Z","avatar_url":"https://github.com/Experiencedeveloper.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Edu CRUD API 📚\n\n[![npm](https://img.shields.io/npm/v/edu-crud-api)](https://npmjs.org/package/edu-crud-api)\n![npm](https://img.shields.io/npm/dm/edu-crud-api)\n![npm](https://img.shields.io/npm/dw/edu-crud-api)\n![install size](https://packagephobia.com/badge?p=edu-crud-api)\n## Introduction\n**Edu CRUD API** is a basic CRUD (Create, Read, Update, Delete) API built with Express.js. It is designed as an educational tool to help developers learn about building APIs, using Node.js, handling requests, and managing data with basic CRUD operations.\n\n## Installation\nTo install the Edu CRUD API package, run the following command:\n\n```bash\nnpm install edu-crud-api\n```\n\n## Usage\nHere's a basic example of how to use the Edu CRUD API in your Node.js project:\n\n### Step 1: Require and Set Up the API\n\n```javascript\nconst express = require('express');\nconst app = express();\nconst eduCrudApi = require('edu-crud-api');\n\napp.use(express.json());\napp.use(eduCrudApi);\n\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, () =\u003e {\n  console.log(`Server is running on port ${PORT}`);\n});\n```\n\n### Step 2: Define Your Routes\nEdu CRUD API provides predefined routes for CRUD operations. You can use them as follows:\n\n- **GET** `/items` - Retrieves a list of all items.\n- **GET** `/items/:id` - Retrieves a single item by its ID.\n- **POST** `/items` - Creates a new item.\n- **PUT** `/items/:id` - Updates an existing item by its ID.\n- **PATCH** `/items/:id` - Partially updates an item by its ID.\n- **DELETE** `/items/:id` - Deletes an item by its ID.\n- **HEAD** `/items/:id` - Checks if an item exists by its ID.\n\n## Example Endpoints\n\n### 🏠 Welcome Message\n**Endpoint**: `/`  \n**Method**: `GET`  \n**Description**: Returns a welcome message.\n\n**Response**:\n```\nWelcome to the CRUD API!\n```\n\n### 📜 Get All Items\n**Endpoint**: `/items`  \n**Method**: `GET`  \n**Description**: Retrieves a list of all items.\n\n**Response**:\n```json\n[\n  {\n    \"id\": \"unique-id-1\",\n    \"Learn\": \"Item 1\"\n  },\n  {\n    \"id\": \"unique-id-2\",\n    \"Learn\": \"Item 2\"\n  }\n]\n```\n\n### 🔍 Get Single Item\n**Endpoint**: `/items/:id`  \n**Method**: `GET`  \n**Description**: Retrieves a single item by its ID.\n\n**Response**:\n```json\n{\n  \"id\": \"unique-id-1\",\n  \"Learn\": \"Item 1\"\n}\n```\n\n### ➕ Create Item\n**Endpoint**: `/items`  \n**Method**: `POST`  \n**Description**: Creates a new item.\n\n**Request Body**:\n```json\n{\n  \"Learn\": \"New Item\"\n}\n```\n\n**Response**:\n```json\n{\n  \"id\": \"new-unique-id\",\n  \"Learn\": \"New Item\"\n}\n```\n\n### 🔄 Update Item\n**Endpoint**: `/items/:id`  \n**Method**: `PUT`  \n**Description**: Updates an existing item by its ID.\n\n**Request Body**:\n```json\n{\n  \"Learn\": \"Updated Item\"\n}\n```\n\n**Response**:\n```json\n{\n  \"id\": \"unique-id-1\",\n  \"Learn\": \"Updated Item\"\n}\n```\n\n### ⚙️ Partially Update Item\n**Endpoint**: `/items/:id`  \n**Method**: `PATCH`  \n**Description**: Partially updates an item by its ID.\n\n**Request Body**:\n```json\n{\n  \"Learn\": \"Partially Updated Item\"\n}\n```\n\n**Response**:\n```json\n{\n  \"id\": \"unique-id-1\",\n  \"Learn\": \"Partially Updated Item\"\n}\n```\n\n### ❌ Delete Item\n**Endpoint**: `/items/:id`  \n**Method**: `DELETE`  \n**Description**: Deletes an item by its ID.\n\n**Response**:\n```\nStatus: 204 No Content\n```\n\n### 🔎 Check Item Existence\n**Endpoint**: `/items/:id`  \n**Method**: `HEAD`  \n**Description**: Checks if an item exists by its ID.\n\n**Response**:\n```\nStatus: 200 OK (if exists) or 404 Not Found (if not exists)\n```\n\n## Error Handling\nIf an item is not found or a bad request is made, the API will respond with an appropriate HTTP status code and message.\n\n### Example Error Response\n\n**Response**:\n```json\n{\n  \"error\": \"Item not found\"\n}\n```\n\n## Features\n- **🔑 UUID**: Uses UUIDs for unique item identification.\n- **✅ Error Handling**: Responds appropriately if an item is not found.\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexperiencedeveloper%2Fedu-crud-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexperiencedeveloper%2Fedu-crud-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexperiencedeveloper%2Fedu-crud-api/lists"}