This repository contains a backend application built with Node.js and MongoDB for managing employees. It provides CRUD (Create, Read, Update, Delete) API endpoints for interacting with employee data.
To run the application locally, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/abhisheksinghf/Employee-API-CRUD-API-s-Using-Node.js-and-MongoDB.git
Go to that directory
cd Employee-API-CRUD-API-s-Using-Node.js-and-MongoDB
- Install dependencies:
npm install express mongoose body-parser
- Start the server:
nodemon server
The server will start on http://localhost:3000 by default.
The following API endpoints are available:
GET /api/employees
: Retrieve all employees.GET /api/employees/:id
: Retrieve an employee by ID.POST /api/employees
: Create a new employee.PATCH /api/employees/:id
: Update an employee by ID.DELETE /api/employees/:id
: Delete an employee by ID.
A Postman collection is provided (Employee-API.postman_collection.json
) with pre-configured requests for testing the API endpoints. Import the collection into Postman and execute the requests to interact with the API.
Please make sure to include the Employee-API.postman_collection.json
file in your repository as mentioned in the README.md.