- Maven 3.xx
- Java 8
- Spring Boot 2
- Postgres SQL
- Postman or similar tools
- Clone repository github.com
- Change connection to database in file application.properties
- Running application in command mvn spring-boot:run
- Ready to call API
- POST posting
curl --location 'http://localhost:8080/api/postings'
--header 'Content-Type: application/json'
--data '{ "tittle": "Second Posting", "description": "Second Description" }' - GET all posting
curl --location 'http://localhost:8080/api/postings' - GET posting by id
curl --location 'http://localhost:8080/api/postings/1' - PUT posting by id
curl --location --request PUT 'http://localhost:8080/api/postings/2'
--header 'Content-Type: application/json'
--data '{ "tittle": "Second Posting 2", "description": "Second Description 2", "published": true }' - GET posting published curl --location 'http://localhost:8080/api/postings/published'
- DELETE posting by id
curl --location --request DELETE 'http://localhost:8080/api/postings/2' - DELETE all posting
curl --location --request DELETE 'http://localhost:8080/api/postings'
Reference: https://www.bezkoder.com/spring-boot-postgresql-example/