{"id":20156395,"url":"https://github.com/abhijeetanand45/restful_api","last_synced_at":"2026-04-12T15:04:05.864Z","repository":{"id":181019211,"uuid":"451577812","full_name":"AbhijeetAnand45/Restful_API","owner":"AbhijeetAnand45","description":"Employee Management REST API","archived":false,"fork":false,"pushed_at":"2024-05-03T19:03:49.000Z","size":3910,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T12:48:49.572Z","etag":null,"topics":["express","mysql-database","mysql2","nodejs","readme","restapi","restapi-example","restful-api","sql"],"latest_commit_sha":null,"homepage":"","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/AbhijeetAnand45.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":"2022-01-24T18:07:57.000Z","updated_at":"2024-05-03T19:07:35.000Z","dependencies_parsed_at":"2025-01-13T12:42:53.603Z","dependency_job_id":"101c1be8-fa19-413a-bc53-9a85c780f8fb","html_url":"https://github.com/AbhijeetAnand45/Restful_API","commit_stats":null,"previous_names":["abhijeetanand45/restful_api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbhijeetAnand45%2FRestful_API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbhijeetAnand45%2FRestful_API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbhijeetAnand45%2FRestful_API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbhijeetAnand45%2FRestful_API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AbhijeetAnand45","download_url":"https://codeload.github.com/AbhijeetAnand45/Restful_API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241596276,"owners_count":19988044,"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":["express","mysql-database","mysql2","nodejs","readme","restapi","restapi-example","restful-api","sql"],"created_at":"2024-11-13T23:38:39.046Z","updated_at":"2026-04-12T15:04:05.768Z","avatar_url":"https://github.com/AbhijeetAnand45.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Employee Management REST API\r\n\r\nThis is a simple Node.js application that provides a RESTful API for managing employees in a MySQL database. It supports CRUD (Create, Read, Update, Delete) operations on the employee table.\r\n\r\n## Prerequisites\r\n\r\nBefore running this application, ensure you have the following installed:\r\n\r\n- Node.js\r\n- MySQL server\r\n\r\n## Installation\r\n\r\n1. Clone the repository:\r\n\r\n    ```\r\n    git clone https://github.com/your_username/Restful_API.git\r\n    ```\r\n\r\n2. Navigate to the project directory:\r\n\r\n    ```\r\n    cd Restful_API\r\n    ```\r\n\r\n3. Install dependencies:\r\n\r\n    ```\r\n    npm install\r\n    ```\r\n\r\n4. Set up your MySQL database:\r\n   \r\n   - Create a MySQL database named `your_db_name`.\r\n   - Create an `employees` table with columns `id`, `name`, `email`, and `salary`.\r\n\r\n5. Configure MySQL connection:\r\n\r\n    In `app.js`, update the MySQL connection details (host, user, password) according to your MySQL setup.\r\n\r\n## Usage\r\n\r\nStart the Node.js server:\r\n    ```\r\n    node myapp.js\r\n    ```\r\n\r\nThe server will start running on `http://localhost:3000`.\r\n\r\n### API Endpoints\r\n\r\n- **GET /employees**: Retrieves all employees.\r\n- **GET /employees/:id**: Retrieves a specific employee by ID.\r\n- **POST /employees**: Creates a new employee.\r\n- **PUT /employees/:id**: Updates an existing employee by ID.\r\n- **DELETE /employees/:id**: Deletes an existing employee by ID.\r\n\r\n## Examples\r\n\r\n### 1. GET /employees\r\n\r\n- **URL:** `http://localhost:3000/employees`\r\n- **Method:** GET\r\n- **Description:** Retrieves all employees from the database.\r\n\r\n**Response:**\r\n\r\n```json\r\n[\r\n    {\r\n        \"id\": 1,\r\n        \"name\": \"John Doe\",\r\n        \"email\": \"john@example.com\",\r\n        \"salary\": 50000\r\n    },\r\n    {\r\n        \"id\": 2,\r\n        \"name\": \"Jane Smith\",\r\n        \"email\": \"jane@example.com\",\r\n        \"salary\": 60000\r\n    },\r\n    // More employee details...\r\n]\r\n```\r\n\r\n### 2. GET /employees/:id\r\n\r\n- **URL:** `http://localhost:3000/employees/:id`\r\n- **Method:** GET\r\n- **Description:** Retrieves a specific employee by their ID.\r\n\r\n**Response:**\r\n\r\n```json\r\n{\r\n    \"id\": 1,\r\n    \"name\": \"John Doe\",\r\n    \"email\": \"john@example.com\",\r\n    \"salary\": 50000\r\n}\r\n```\r\n\r\n### 3. POST /employees\r\n\r\n- **URL:** `http://localhost:3000/employees`\r\n- **Method:** POST\r\n- **Description:** Creates a new employee record in the database.\r\n\r\n**Request:**\r\n\r\n```json\r\n{\r\n    \"name\": \"Alice Cooper\",\r\n    \"email\": \"alice@example.com\",\r\n    \"salary\": 55000\r\n}\r\n```\r\n\r\n**Response:**\r\n\r\n```json\r\n{\r\n    \"message\": \"Employee added successfully\",\r\n    \"id\": 3\r\n}\r\n```\r\n\r\n### 4. PUT /employees\r\n\r\n- **URL:** `http://localhost:3000/employees/:id`\r\n- **Method:** PUT\r\n- **Description:** Updates an existing employee record identified by their ID.\r\n\r\n**Request:**\r\n\r\n```json\r\n{\r\n    \"name\": \"Alice Cooper\",\r\n    \"email\": \"alice@example.com\",\r\n    \"salary\": 60000\r\n}\r\n```\r\n\r\n**Response:**\r\n\r\n```json\r\n{\r\n    \"message\": \"Employee updated successfully\"\r\n}\r\n```\r\n\r\n### 5. DELETE /employees/:id\r\n\r\n- **URL:** `http://localhost:3000/employees/:id`\r\n- **Method:** DELETE\r\n- **Description:** Deletes an existing employee record identified by their ID.\r\n\r\n**Response:**\r\n\r\n```json\r\n{\r\n    \"message\": \"Employee deleted successfully\"\r\n}\r\n```\r\n\r\n\u003e With Love, Abhijeet..\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhijeetanand45%2Frestful_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhijeetanand45%2Frestful_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhijeetanand45%2Frestful_api/lists"}