Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Latest commit

 

History

History

greeting-springboot-liberty

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Spring Boot Greeting application with autoconfiguration

This application shows how to connect to a Cloudant database using the new Spring Boot starter provided by the Cloudant Spring Library. The library provides Spring capabilities on top of the official Cloudant Java library.

Pre-requisites

Building and running

Before running create a src/main/resources/cloudant.properties file with your Cloudant credentials:

cloudant.username=cloudantUsername
cloudant.password=cloudantPassword
cloudant.url=cloudantUrl
cloudant.db=databaseName

To build and run:

  • mvn clean install
  • java -jar target/greeting-springboot-liberty-0.0.1-SNAPSHOT.jar

Available endpoints:

  • http://localhost:8080/databases
  • http://localhost:8080/greeting
  • http://localhost:8080/greeting/{id}

Create a new greeting by supplying some content:

curl -H "Content-Type: application/json" -d '{"content":"test123"}' http://localhost:8080/greeting

Ask for all known greetings:

curl http://localhost:8080/greeting

Ask for a particular greeting:

curl http://localhost:8080/greeting/ID

Delete a greeting:

curl -X DELETE http://localhost:8080/greeting/ID