An open API service indexing awesome lists of open source software.

https://github.com/guilhermeluan/restapijava

Java Rest API using Spring + PostgreSQL
https://github.com/guilhermeluan/restapijava

backend-api java junit5 postgresql rest-api spring

Last synced: 4 months ago
JSON representation

Java Rest API using Spring + PostgreSQL

Awesome Lists containing this project

README

          

RestfullAPI-Spring 💻


Technologies
Getting Started
API Endpoints
Collaborators
Contribute


A Rest API that registers products with CRUD operations.

💻 Technologies

- Java
- PostgresSQL
- Spring Boot
- JPA
- JUnit 5
- Docker

🚀 Getting started

Prerequisites

- [Java 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
- [Git](https://git-scm.com/)
- [Docker](https://www.docker.com/products/docker-desktop/)

Cloning

```bash
git clone https://github.com/GuilhermeLuan/RestfullAPI-Spring
```

Starting

```bash
cd RestfullAPI-Sping
docker compose up
./mvnw clean install
./mvnw spring-boot:run
```

📍 API Endpoints

| route | description |
|-------------------------------------------|----------------------------------------------------------------------|
| GET /api/v1/products | retrieves a list of all products. |
| GET /api/v1/products/{UUID} | retrieves a specific product by its unique identifier (UUID). |
| PUT /api/v1/products | modifies a specific product by its unique identifier on body (UUID). |
| POST /api/v1/products | creates a product in the database. |
| DELETE /api/v1/products/{UUID} | deletes a specific product by its unique identifier (UUID). |

GET /api/products

**RESPONSE**
```json
[
{
"idProduct": "ee2737a5-d773-4106-ab60-c3ffbe95ec0e",
"name": "Iphone 14 Pro",
"valueProduct": 5000
}
]
```

GET /api/products/{UUID}

**RESPONSE**
```json
[
{
"idProduct": "ee2737a5-d773-4106-ab60-c3ffbe95ec0e",
"name": "Iphone 14 Pro",
"valueProduct": 5000
}
]
```

PUT /api/products/{UUID}

**REQUEST**
```json
{
"idProduct": "ee2737a5-d773-4106-ab60-c3ffbe95ec0e",
"name": "Iphone 14 Pro",
"valueProduct": 5000
}
```

**RESPONSE**
```json
{
"idProduct": "ee2737a5-d773-4106-ab60-c3ffbe95ec0e",
"name": "Iphone 14 Pro",
"valueProduct": 5000
}
```

POST /api/products

**REQUEST**
```json
{
"name": "Iphone 14",
"valueProduct": 5000
}
```

**RESPONSE**
```json
{
"idProduct": "ee2737a5-d773-4106-ab60-c3ffbe95ec0e",
"name": "Iphone 14",
"valueProduct": 5000
}
```

DELETE /api/products/{UUID}

**RESPONSE**
```text
"Product deleted successfully"
```

🤝 Collaborators

Special thank you for all people that contributed for this project.




Guilherme Luan Profile Picture


Guilherme Luan



📫 Contribute

1. `git clone https://github.com/GuilhermeLuan/RestfullAPI-Spring`
2. `git checkout -b feature/NAME`
3. Follow commit patterns
4. Open a Pull Request explaining the problem solved or feature made, if exists, append screenshot of visual modifications and wait for the review!

Documentations that might help

[📝 How to create a Pull Request](https://www.atlassian.com/br/git/tutorials/making-a-pull-request)

[💾 Commit pattern](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)