To run the application, you need the following installed:
- Java 17
- Maven
- Make
- Docker
- Git
The application is dependent on certain environment variables in order to run.
Add the following .env file to the root directory after cloning the project:
# Insert the following .env file to root directory after cloning
DB_NAME=sparesti_db
MYSQL_URL=jdbc:mysql://db:3306/${DB_NAME}
MYSQL_USERNAME=root
MYSQL_ROOT_PASSWORD=password
SECRET_KEY=87EF7185F1C9A5053F5D0B25CCDF039FA3DEF82C0504ACDC9110FC444237BC57
[email protected]
EMAIL_PASSWORD=wakd klwc nivw whzl
The application can be run with one command in the following joint repository: Joint-Repository
- Clone the repository
git clone [email protected]:idatt2106-gruppe-2/idatt2106_2024_02_backend.git
- Navigate to the project root folder
cd idatt2106_2024_02_backend
- Create an
.env
file in the project root directory by copying over the.env.example
file:
cp .env.example .env
If you are on Windows Command Prompt use:
copy .env.example .env
NOTE: We are fully aware that this file should not be public and that the user should use their own configuration parameters, but for the ease of the examiners we have chosen to do it this way.
- Run the application (OBS: Make sure docker is running). It will take a few minutes the first time you run the application.
make run
The application is now running on port 8080.
NOTE: If you don't have Make installed, use the following command instead:
docker compose up
To exit the application, use CTRL+C. You can rerun the application by using
make run
again.
The database is populated with a pre-configured user at runtime which can be used to experiment with the application. You can log in with the following credentials:
- Username:
username
- Password:
Test123!
You can run unit and integration tests with:
make test
This will generate a target
folder with test coverage data. You can now find the report
by navigating the folder structure: target -> site -> jacoco -> index.html
.
The REST endpoints are documented using Swagger UI. The documentation is generated at runtime and can be found here.
The entire backend source code has been documented with Javadoc. The entire documentation is deployed with Gitlab Pages and can be found here.
Run make help
to get a list of all possible commands, along with a short explanation for their use case. Alternatively, take a look at the Makefile for what each command does programmatically. Some of the commands are also mentioned below:
make test
: Test the applicationmake destroy
: Tear down the applicationmake format
: Format the source codemake build
: Build the containers that the application runs inmake compile
: Compile the source code