sample dockerized spring boot application that exposes REST APIs
249
This image contains a spring boot application that exposes APIs for CRUD operations on the dockerized IBM Cloudant Developer container.
To be able to call REST APIs from this image, first run and initialize the IBM Cloudant container available here. https://hub.docker.com/r/ibmcom/cloudant-developer/
Follow the instructions on the link above to start the cloudant container. Once the Cloudant container is up and running, create a container from this image by running the following command:
docker run -p 8765:8765 -t amitkarir/cloudant-spring-boot-example
The above command will launch a containerized spring boot application that will connect to the Cloudant container already running.
Once both containers are running, use the docker machine IP in a rest client (Postman) to hit the docerized DB instance.
CRUD operation details:
http://:8765/employee (GET API to fetch all documents) http://:8765/employee/<_id> (GET API to fetch a document by ID) http://:8765/employee/band/<_emplyee_band> (GET API to fetch employees by band) http://:8765/employee/<_id> (PUT API to update an employee) http://:8765/employee (POST API to create an employee) http://:8765/employee/<_id> (DELETE API to delete a document by ID)
Sample payload for POST/PUT follows:
{ "name": "Amit Karir", "band": "7A" }
{
"name": "Amit Karir",
"band": "7A",
"doj" : "2015-12-12",
"location":"TPO Pune",
"skills": [
{
"skill":"Spring Boot",
"experience":5
},
{
"skill":"Cloudant",
"experience":6
},
{
"skill":"Scala",
"experience":0
},
{
"skill":"Akka",
"experience":0
}
]
}
Content type
Image
Digest
Size
93.7 MB
Last updated
about 10 years ago
docker pull amitkarir/cloudant-spring-boot-example