Ensure MongoDB is Running Locally:
cd src/docker
docker-compose up -d
Make sure you have MongoDB installed and running on your local machine or run it via docker.
By default, MongoDB runs on localhost:27017.
-
Open a terminal and navigate to the directory containing your pom.xml.
-
Run the application using Maven
./mvnw spring-boot:run
You can test the REST API using tools like curl or Postman.
curl -X GET http://localhost:8080/users
curl -X POST http://localhost:8080/users -H "Content-Type: application/json" -d '{"name": "John Doe", "email": "john.doe@example.com"}'
curl -X GET http://localhost:8080/users/{id}
curl -X PUT http://localhost:8080/users/{id} -H "Content-Type: application/json" -d '{"name": "Jane Doe", "email": "jane.doe@example.com"}'
curl -X DELETE http://localhost:8080/users/{id}