jusju / shoppinglist-backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shoppinglist backend

This is the backend application for the shoppinglist project. It is developed with Java and Spring Boot.

OpenAPI and Swagger UI

REST API has OpenAPI specification documentation and it can be interactively tested with Swagger UI. These tools automatically generate documentation for the API endpoints.

  • OpenAPI docs: /api-docs
  • Swagger UI: /swagger-ui/index.html or /swagger-ui.html

Testing

Tests are written with JUnit unit testing framework and use a separate H2 in-memory database.

To run tests with H2 database, you need to set Spring profile to test mode with SPRING_PROFILES_ACTIVE=test environment variable when running tests. This will then use the src/test/resources/application.properties configurations.

Development mode

There is development mode that you can enable by setting environment variable SPRING_PROFILES_ACTIVE=development when running the application. This development mode uses H2 database instead of PostgreSQL.

application-development.properties will be used over application.properties. These can be found in src/main/resources.

How to run with Docker

With Docker you can run the backend application and PostgreSQL locally using Docker Compose. You don't need to install PostgreSQL on your own machine.

Run the app and database

cd shoppinglist-backend
docker compose up -d

The application will be available at localhost:8080

Stop and remove containers

docker compose down

About

License:MIT License


Languages

Language:Java 88.8%Language:HTML 10.2%Language:JavaScript 0.5%Language:Dockerfile 0.5%