This is a RESTful API for a CRM (Customer Relationship Management) system built using Node.js, Express, and MongoDB.
-
Clone the repository:
git clone https://github.com/sinehan001/crm-api.git
-
Installation Dependencies
cd crm-api npm install
-
Set up MongoDB: Make sure you have MongoDB installed and running locally or provide the MongoDB URI in app.js.
-
Start the server:
npm start
- URL: POST /api/customers
- Request Body:
{
"name": "John Doe",
"email": "[email protected]",
"phone": "1234567890"
}
- Response:
{
"_id": "60a9f3b4a4a2c835241882a1",
"name": "John Doe",
"email": "[email protected]",
"phone": "1234567890",
"__v": 0
}
- URL: GET /api/customers
- Response:
[
{
"_id": "60a9f3b4a4a2c835241882a1",
"name": "John Doe",
"email": "[email protected]",
"phone": "1234567890",
"__v": 0
},
{
"_id": "60a9f3d5a4a2c835241882a2",
"name": "Jane Smith",
"email": "[email protected]",
"phone": "9876543210",
"__v": 0
}
]
- URL: GET /api/customers/{id}
- Response:
{
"_id": "60a9f3b4a4a2c835241882a1",
"name": "John Doe",
"email": "[email protected]",
"phone": "1234567890",
"__v": 0
}
- URL: PUT /api/customers/{id}
- Request Body:
{
"name": "John Doe",
"email": "[email protected]",
"phone": "5555555555"
}
- Response:
{
"_id": "60a9f3b4a4a2c835241882a1",
"name": "John Doe",
"email": "[email protected]",
"phone": "5555555555",
"__v": 0
}
- URL: DELETE /api/customers/{id}
- Response:
{
"message": "Customer deleted successfully"
}