-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,84 @@ | ||
# Yappi | ||
# yappi backend | ||
|
||
## Getting Started | ||
This repository contains the API controllers and backend logic of yappi as the connection to the database. | ||
|
||
This project contains the API controllers and back-end logic as the connection to the database. | ||
### 🚀 Getting Started | ||
|
||
## Swagger API documentation | ||
##### First, clone the repository to your local machine: | ||
```bash | ||
git clone https://github.com/24FSIIT16/dear-dev-backend.git | ||
``` | ||
|
||
The API documentation is available on the following URL: http://localhost:8080/swagger-ui/index.html | ||
##### Create an `.env` file in the root directory of the project and add the following environment variables: | ||
|
||
``` | ||
# Password for the yappi_db database | ||
DATABASE_PASSWORD=your_password | ||
# JWT secret key, used for verifying the token. | ||
# If you plan to use this together with the frontend, make sure to use the same secret key in the frontend. | ||
JWT_SECRET=your_secret_key | ||
``` | ||
|
||
##### Changes needed in the `application.properties` file. Replace spring datasource with: | ||
``` | ||
spring.datasource.url=jdbc:postgresql://localhost:5432/yappi_db | ||
``` | ||
|
||
##### Build to project: | ||
```bash | ||
./gradlew build | ||
``` | ||
|
||
## Docker | ||
##### Run the project: | ||
```bash | ||
./gradlew bootRun | ||
``` | ||
The project will be running on `http://localhost:8080`. | ||
|
||
##### Start the project with docker-compose: | ||
```bash | ||
docker compose up -d | ||
``` | ||
This will build the project and start it in a docker container, that includes the database as well. The project will be running on `http://localhost:8080`. | ||
|
||
Start project local with docker-compose: | ||
If you want to change for example the database name, you can do so in the `docker-compose.yml` file. | ||
|
||
### 📚 Swagger API documentation | ||
|
||
The API documentation is available on the following URL: http://localhost:8080/swagger-ui/index.html | ||
|
||
### 🛟 Usefull Docker commands | ||
List all running container: | ||
``` | ||
docker-compose up --build | ||
docker ps | ||
``` | ||
|
||
Clean and remove docker images / container: | ||
Clean and remove docker images / container | ||
|
||
``` | ||
sudo docker stop $(sudo docker ps -q) true | ||
sudo docker stop $(sudo docker ps -q) true | ||
sudo docker rm $(sudo docker ps -a -q) true | ||
sudo docker image rm $(sudo docker images -q) || true | ||
``` | ||
|
||
View logs of the running container: | ||
``` | ||
docker logs -f <container_id> | ||
``` | ||
|
||
Delete docker volumes: | ||
|
||
``` | ||
docker volumne prune -f | ||
``` | ||
``` | ||
|
||
### 📦 Built With | ||
- Java 21 | ||
- PostgreSQL 13.0 | ||
- Spring Boot 3.3.0 | ||
- Sprint Boot Starter Data JPA | ||
- Spring Boot Starter Security | ||
- Spring Boot Starter Web | ||
- Spring Boot Starter Validation | ||
- Spring Boot Starter Test |