Skip to content

A simple Spring Boot PostgreSQL JPA Hibernate REST API Demo for Halaqoh IT #3

Notifications You must be signed in to change notification settings

KominfoPemudaPersis/spring-boot-postgresql

Repository files navigation

Spring Boot, PostgreSQL, JPA, Hibernate REST API Demo

Steps to Setup

1. Clone the repository

git clone https://gitlab.com/hendisantika/spring-boot-postgresql.git

2. Configure PostgreSQL

First, create a database named postgres_demo. Then, open src/main/resources/application.properties file and change the spring datasource username and password as per your PostgreSQL installation.

3. Run the app

Type the following command from the root directory of the project to run it -

mvn clean spring-boot:run

Alternatively, you can package the application in the form of a JAR file and then run it like so -

mvn clean package
java -jar target/spring-boot-postgresql-0.0.1-SNAPSHOT.jar

The application will start on the default port 8080.

The following screenshots show you how to test the APIs using Postman.

1. Create Question POST /questions

Create Question POST /questions

2. Get paginated Questions GET /questions?page=0&size=2&sort=createdAt,desc

Get paginated Questions GET /questions?page=0&size=2&sort=createdAt,desc

3. Create Answer POST /questions/{questionId}/answers

Create Answer POST /questions/{questionId}/answers

4. Get all answers of a Question GET /questions/{questionId}/answers

Get all answers of a Question GET /questions/{questionId}/answers

About

A simple Spring Boot PostgreSQL JPA Hibernate REST API Demo for Halaqoh IT #3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages