API small e-commerce electronic commerce, is a system of buying and selling products or services over the internet. It is a business model that has become very popular due to its convenience and efficiency.
Functional Requirements! You can see what is left to do! Click here.
To configure the ecommerceget project, follow the instructions below:
DEVELOPER Environment
-
Enter the backend folder:
cd /
-
Configure the
application.properties
file for the database settings (located insrc/main/resources
):# HIBERNATE spring.datasource.url=jdbc:postgresql://localhost:5432/e-commerce spring.datasource.username=admin spring.datasource.password=admin # SERVER server.error.include-stacktrace=never #server.port=8080 server.servlet.contextPath=/api/v1 # TOKENS api.security.token.secret=${JWT_Secret:joao}
-
Build the project with Maven:
./mvnw clean install
-
Start the Spring Boot server:
./mvnw spring-boot:run
PRODUCTION DOCKER Environment
-
Create a folder named
db
in this directory. -
Inside this folder, create two files:
db.env
with the following information:``` POSTGRES_USER=username POSTGRES_PASSWORD=password ```
init.sql
with the following commands: -- Replaceusername
with the selected application user.``` CREATE USER e-commerceget; CREATE DATABASE e-commerceget; GRANT ALL PRIVILEGES ON DATABASE e-commerceget TO username; ```
-
In the
application-prod.properties
file, update the information to match your database settings:# JPA spring.datasource.url=jdbc:postgresql://e-commerceget-container:5432/e-commerceget spring.datasource.username=username spring.datasource.password=password # SERVER server.error.include-stacktrace=never server.port=8080 server.servlet.contextPath=/api/v1 # TOKENS api.security.token.secret=${JWT_Secret:joao} #spring.jpa.hibernate.ddl-auto=update #spring.jpa.properties.hibernate.jdbc.lab.non_contextual_creation=true #flyway.ignoreMigrationPatterns="repeatable:missing"
-
Now, just run the command
docker-compose up -d
in the root directory. -
Ensure that the PostgreSQL database is configured and running.
-
In the terminal, navigate to the project's root directory.
-
Run the following command to start the Spring Boot server:
./mvnw spring-boot:run
-
The Spring Boot server will start and be listening for requests on the defined port.
http://localhost:8081/api/v1/login
-
Use the routes and endpoints provided by the server to manage the deployment processes.
-
Access the Documents Folder:
- Navigate to the
/docs
folder on your computer.
- Navigate to the
-
Locate the Collection File:
- Find the JSON file named
insomnia.json
.
- Find the JSON file named
-
Open Insomnia:
- Start Insomnia on your computer.
-
Import the Collection:
- Click on the menu icon in the top left corner (three horizontal lines).
- Select "Import/Export".
- Click "Import Data".
- Choose "From File".
- Navigate to the
/docs/collections
folder, select the collection file, and click "Open".
-
Verify Import:
- After the import, verify that the collection was added correctly in Insomnia.
Done! The collection should now be available in Insomnia for you to use.
You can:
- Register products
- Manage orders
- Manage stock
Benefits:
- Centralize the management of products and orders
- Monitor the status of each order
- Facilitate the management of stock
Usage Example:
- An online store can use the system to register all available products, manage received orders, and track the delivery status of each order.
- A sales manager can use the system to check which products are selling the most and adjust the stock according to demand.
João Guilherme 🚀
Made with 🤭 by João Guilherme 👋🏽 Get in touch below!