Customer API
This project is a simple RESTful API for managing customers. It allows users to retrieve a list of all customers and add new customers. The API is built using Spring Boot and MongoDB to persist the data.
Getting Started
To get started with this project, follow these steps:
- Clone this repository to your local machine.
- Ensure you have MongoDB installed and running locally on your machine.
- Open the project in your preferred IDE.
- Run the main file CustomerApiApplication.java with @SpringBootApplication annotation.
- Alternatively, you can build and run the project using Gradle:
./gradlew bootRun
Usage
Get All Customers
Endpoint: GET /customers
Retrieves a list of all customers.
Add Customer
Endpoint: POST /customers
Adds a new customer to the system.
Request Body
{
"name": "Customer Name",
"email": "customer@example.com",
}
Replace "Customer Name"
and "customer@example.com"
with the actual details of the customer you want to add.
Postman Collections
For testing the API endpoints, you can use the Postman collection provided in the link below: