Skip to content

VladDm93/SpringProjectExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple REST api example

Why this project exists?

To show how to implement simple REST api using:

How to run?

  1. Install postgres
  • Create database using file from dev-support/database_setup.sql
  • If you know what docker-compose is, go to dev-support folder, it contains docker-compose.yml which will run postgres database with default parameters (database name, username\password)
  1. Run ./mvn spring-boot:run
  2. Go to http://localhost:8080/swagger-ui.html

Windows users. Attention!!!

This project uses TestContainers (https://www.testcontainers.org/) in order to run integration tests with postgres. This can be a problem on windows. So you must specify database params:

mvnw clean verify -Dspring.datasource.url=jdbc:postgresql://localhost:5432/data_base_name -Dspring.datasource.username=postgres -Dspring.datasource.password=postgres

Params

If you don't know how to specify params learn it here: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

  • spring.datasource.url - postgres jdbc url. Example: jdbc:postgresql://localhost:5432/cat_database
  • spring.datasource.username - postgres user username
  • spring.datasource.password - postgres user password

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages