This project consists of building an online store, where the user can initially see all the products, can search for them, sort them in ascending or descending order and can also filter the products by category. In addition, the user can see the products with the discount applied in case they have a discount.
It is requested to build separately Backend (REST API) and Frontend (application that consumes it).
The REST API was developed with Node.js and Express. The REST API connects and makes SQL queries to a MySQL database deployed in AWS RDS. This database has two tables: products and categories. To request the data, the REST API was developed with the following endpoints that can be viewed and executed in Postman: API Documentation.
| Node.js - JavaScript environment | |
| Express - The web framework used | |
| Vercel - Cloud Application Platform for deploy | |
| MySQL - Relational database | |
GET https://api-store-seven.vercel.app/api/products?ordering=desc&category=5
| Params | Type | Description |
|---|---|---|
ordering |
string |
Optional can be asc or desc |
search |
string |
Optional filter by name |
category |
integer |
Optional filter by category |
List products. You can use query params to filter them by category, ordering and search.
GET https://api-store-seven.vercel.app/api/categories
List categories.
Click on Code
Copy the repository URL.
Open Git Bash and change the current working directory to the location where you want to clone the project.
git clone https://github.com/allisonvp/api-store.gitGo to the project directory
cd api-store/Open the project and create the .env file. You will need to add the following environment variables to your .env file.
Install dependencies
npm installStart the server
npm run startOpen a web browser and access to the localhost API endpoint with the port 3000: http://localhost:3000/api/products.
To run this project, you will need to add the following environment variables to your .env file
DB_NAME
DB_HOST
DB_USER
DB_PASSWORD