Skip to content

DouglasLiebl/Library-API

Repository files navigation

Java Spring Postgres Build Status codecov

Library-API

This is a project that takes care of the management of books and loans in a library using the TDD (Test Driven Development) technique. Uses Java 17 and Spring Boot 3.1.3 and PostgreSQL as database despite using the H2 database due to TravisCI

Installation

  1. Clone the repository:
git clone https://github.com/DouglasLiebl/Library-API.git
  1. Install dependencies with Maven

  2. (Optional) This project is using H2 database but you can change it. Install PostgreSQL and put those lines on application.yaml:

  jpa:
    database: postgresql
    hibernate:
     ddl-auto: update
    show-sql: true
    properties:
      hibernate:
       jdbc:
          lab:
            non_contextual_creation: true
    generate-ddl: true

  datasource:
    url: jdbc:postgresql://localhost:5432/ # Your database name
    username: # Your postgres username
    password: # Your postgres password
    driver-class-name: org.postgresql.Driver

Usage

  1. Just start the application.
  2. (Using PostgreSQL) Make sure your PostgreSQL is running on your machine.

Usage with docker

  1. Open the command prompt in the project folder and type the commands bellow:
docker build -t preferred-name-for-image .

then

docker run --name name-for-conteiner -p 8080:8080 image-name
  1. If you wanna use PostgreSQL put this different part on your application.yaml:
 datasource:
    url: jdbc:postgresql://postgresql:5432/library-api

and type this command:

docker compose up --build

About

API for managing a library developed to study TDD.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors