Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esperanca-leonardo/quick-form-fill-backend
Quick Form Fill Backend is an API developed in Spring Boot to manage CRUD (Create, Read, Update, Delete) operations for products.
https://github.com/esperanca-leonardo/quick-form-fill-backend
aspect-oriented-programming crud exception-handler h2-database jpa lombok modelmapper reflection rest-api spring-boot
Last synced: 5 days ago
JSON representation
Quick Form Fill Backend is an API developed in Spring Boot to manage CRUD (Create, Read, Update, Delete) operations for products.
- Host: GitHub
- URL: https://github.com/esperanca-leonardo/quick-form-fill-backend
- Owner: esperanca-leonardo
- Created: 2024-05-17T19:04:36.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T00:23:12.000Z (6 months ago)
- Last Synced: 2024-05-23T00:56:13.213Z (6 months ago)
- Topics: aspect-oriented-programming, crud, exception-handler, h2-database, jpa, lombok, modelmapper, reflection, rest-api, spring-boot
- Language: Java
- Homepage:
- Size: 140 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 📋 Quick Form Fill Backend
Quick Form Fill Backend is a simple API developed using Spring Boot, designed to manage CRUD (Create, Read, Update, Delete) operations for products. This backend service provides an easy way to handle product data, facilitating integration with front-end applications.
## 📑 Table of Contents
- [Key Features](#-key-features)
- [Tools and Technologies Used](#-tools-and-technologies-used)
- [Prerequisites](#-prerequisites)
- [Installation Instructions](#-installation-instructions)
- [Clone the Repository](#1-clone-the-repository)
- [Navigate to the Project Directory](#2-navigate-to-the-project-directory)
- [Run the Application](#3-run-the-application)
- [For Windows](#for-windows)
- [For Linux and macOS](#for-windows)
- [Insomnia Requests](#-insomnia-requests)
- [Usage Examples](#-usage-examples)
- [Create a Product](#-create-a-product)
- [Retrieve a Product by ID](#-retrieve-a-product-by-id)
- [Retrieve All Products](#-retrieve-all-products)
- [Update a Product](#%EF%B8%8F-update-a-product)
- [Delete a Product](#%EF%B8%8F-delete-a-product)## 🚀 Key Features
- 🆕 **Create Products:** Add new products with information such as name, price, and description.
- 🔍 **Read Products:** Retrieve a list of all products or get details of a specific product by its ID.
- ✏️ **Update Products:** Modify existing product information to keep your data up-to-date.
- 🗑️ **Delete Products:** Remove products that are no longer needed.## 🔧 Tools and Technologies Used
- [**Aspect:**](https://docs.spring.io/spring-framework/reference/core/aop.html) Implements cross-cutting concerns.
- [**H2 Database:**](https://www.h2database.com/html/main.html) Embedded SQL database.
- [**Java:**](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) General-purpose programming language.
- [**Lombok:**](https://projectlombok.org/) Reduces code verbosity.
- [**ModelMapper:**](https://modelmapper.org/) Facilitates object mapping.
- [**Reflection:**](https://www.oracle.com/technical-resources/articles/java/javareflection.html) Allows examining and modifying classes at runtime.
- [**Spring Boot Starter Data JPA:**](https://spring.io/projects/spring-data-jpa) Facilitates database access.
- [**Spring Boot Starter Test:**](https://docs.spring.io/spring-boot/docs/2.1.13.RELEASE/reference/html/boot-features-testing.html) Support for automated testing.
- [**Spring Boot Starter Web:**](https://docs.spring.io/spring-boot/docs/current/reference/html/web.html) Facilitates web application development.## 📋 Prerequisites
Before running the application, ensure you have the following prerequisites installed:- [**Git:**](https://git-scm.com/) Widely-used distributed version control system.
- [**Java 17:**](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) A stable version of the Java Development Kit (JDK).
## 📝 Installation Instructions
### 1. Clone the Repository
```bash
git clone https://github.com/esperanca-leonardo/quick-form-fill-backend.git
```### 2. Navigate to the Project Directory
```bash
cd quick-form-fill-backend
```### 3. Run the Application
Depending on your operating system, follow the commands below to start the application.- #### For Windows
```bash
.\mvnw.cmd spring-boot:run
```- #### For Linux and macOS
First, give execute permission to the script```bash
chmod u+x mvnw
```Then, run the command to start the application
```bash
./mvnw spring-boot:run
```## 📂 Insomnia Requests
For greater convenience, an Insomnia file containing all the API requests has been created. This allows you to easily test the endpoints without having to manually configure each request. The file is named `InsomniaRequests.json` and is located in the root of the project.To use this file, follow these steps
1. Open Insomnia.
2. Go to `Application` > `Preferences` > `Data` tab.
3. Click on `Import Data` and select `From File`.
4. Choose the `InsomniaRequests.json` file from the root of the project.
5. The requests will be imported and ready to use.## 📚 Usage Examples
Below are examples of how to use the Quick Form Fill Backend API endpoints in different scenarios. These examples can help you understand how to interact with the API effectively. By default, the application will run on `localhost:8080`.
- ### 🆕 Create a Product
- To create a new product, send a `POST` request to the `/products` endpoint with the product details in the request body. The request body should be in JSON format as shown below
```json
{
"name": "Wireless Mouse",
"description": "A high-precision wireless mouse",
"category": "Electronics",
"price": 29.99,
"amount": 150,
"supplier": "TechSupplier Co.",
"brand": "TechBrand"
}
```- If the product is created successfully, the API will respond with a status code `201 Created` and the details of the newly created product in the response body
```json
{
"id": 1,
"name": "Wireless Mouse",
"description": "A high-precision wireless mouse",
"category": "Electronics",
"price": 29.99,
"amount": 150,
"supplier": "TechSupplier Co.",
"brand": "TechBrand"
}
```- ### 🔍 Retrieve a Product by ID
- To retrieve details of a specific product by its ID, send a `GET` request to the `/products/{id}` endpoint, replacing `{id}` with the actual product ID.
If the product with the specified ID exists, the API will respond with a status code `200 OK` and the details of the product in the response body```json
{
"id": 1,
"name": "Wireless Mouse",
"description": "A high-precision wireless mouse",
"category": "Electronics",
"price": 29.99,
"amount": 150,
"supplier": "TechSupplier Co.",
"brand": "TechBrand"
}
```- If the product with the specified ID, in this case `2`, is not found, the API will respond with a status code `404 Not Found` and an error message in the response body
```json
{
"status": 404,
"timestamp": "2024-05-17T23:00:03-03:00",
"type": "https://quickformfill.com.br/product-not-found",
"title": "Product not found",
"detail": "Product not found with ID: 2"
}
```
- ### 📄 Retrieve All Products
- To retrieve a list of all products, send a `GET` request to the `/products` endpoint.
If the request is successful, the API will respond with a status code `200 OK` and an array of product details in the response body. For example```json
[
{
"id": 1,
"name": "Wireless Mouse",
"description": "A high-precision wireless mouse",
"category": "Electronics",
"price": 29.99,
"amount": 150,
"supplier": "TechSupplier Co.",
"brand": "TechBrand"
}
]
```
- ### ✏️ Update a Product
- To update an existing product, send a PUT request to the `/products/{id}` endpoint with the updated product details in the request body. Replace `{id}` with the actual product ID. The request body should be in JSON format as shown below.
```json
{
"name": "Ergonomic Wireless Mouse",
"description": "An ergonomic wireless mouse with additional buttons",
"category": "Electronics",
"price": 39.99,
"amount": 200,
"supplier": "TechSupplier Co.",
"brand": "TechBrand"
}
```
- If the product with the specified ID exists and is successfully updated, the API will respond with a status code `200 OK` and the updated details of the product in the response body```json
{
"id": 1,
"name": "Ergonomic Wireless Mouse",
"description": "An ergonomic wireless mouse with additional buttons",
"category": "Electronics",
"price": 39.99,
"amount": 200,
"supplier": "TechSupplier Co.",
"brand": "TechBrand"
}
```- If the product with the specified ID, in this case `2`, is not found, the API will respond with a status code `404 Not Found` and an error message in the response body
```json
{
"status": 404,
"timestamp": "2024-05-17T23:00:03-03:00",
"type": "https://quickformfill.com.br/product-not-found",
"title": "Product not found",
"detail": "Product not found with ID: 2"
}
```- ### 🗑️ Delete a Product
- To delete an existing product, send a DELETE request to the `/products/{id}` endpoint. Replace `{id}` with the actual product ID you want to delete. If the product with the specified ID is successfully deleted, the API will respond with a status code `204 No Content` and no response body.- If the product with the specified ID, in this case `2`, is not found, the API will respond with a status code `404 Not Found` and an error message in the response body
```json
{
"status": 404,
"timestamp": "2024-05-17T23:00:03-03:00",
"type": "https://quickformfill.com.br/product-not-found",
"title": "Product not found",
"detail": "Product not found with ID: 2"
}
```