This application was developed as a back end for an e-commerce website that uses the latest technologies and allows the user to compete with other e-commerce businesses, with the manager of an online retail company as the target user. This e-commerce application uses object-relational mapping (ORM) and has a modified back end starter code. Additionally, its working Express.js API is configured to use Sequelize as the key component to interact with the MySQL database, which consists of tables for categories, products, tags, and product tags. RESTful API routes point to each standard Create, Read, Update, and Delete (CRUD) operation to make requests on the database.
-
First, clone the git repository from GitHub
- Open the clone file in VS code or in your terminal
- Create your
.gitignore
and.env
files. - Check the
dependencies
anddev-dependencies
that are needed onpackage.json
.
-
Next, set up all the existing npm packages, run
npm init
. -
Then, install the required dependencies on the
node_modules
folder, run:npm install
. -
Then, to create your database, go to the terminal and run:
mysql -u root -p
.- Enter mysql password when prompted.
- Next, enter
source db/schema.sql
. - Then, to seed the database, exit out of mysql cmd line:
exit
, then run:npm run seed
.
-
To invoke the application, run:
npm start
. The Sequelize models sync to the MySQL database when the server starts. -
To test the application, use
Insomnia
orPostman
(view Test section).
-
First, make sure to install the given application following the previous steps and video walkthrough.
-
Next, confirm if the tables were created and the database was seeded.on MySQL Workbench.
-
Navigate to MySQL Workbench app, click Schemas and the database name
Ecommerce
for the application. -
Click the tables, and the following models and requirements will be displayed when the commands are run:
SELECT * FROM ecommerce.category
SELECT * FROM ecommerce.product
SELECT * FROM ecommerce.product_tag
SELECT * FROM ecommerce.tag
-
-
Then, using
Insomnia
orPostman
, test the application's CRUD commands:- Using the API GET routes for categories, products, or tags, the data for each of these routes will be displayed.
- When the user clicks the
GET
request forALL
categories, products, or tags, then they are presented with all the data according to each route. - When the user clicks the
GET
request for aSINGLE
category, product, or tag ID, then they are presented with data for the appropriate ID of each route folder. - When the user tests the
POST
,PUT
, orDELETE
API routes for categories, products, or tags, then they are able tocreate
,update
, ordelete
data within each route folder.
-
Begin by cloning the Repo from the GitHub page, then create a new branch to test the application.
-
Run the following
CRUD
commands in Insomnia or Postman.-
READ -
GET
- localhost:3001/api/categories
- localhost:3001/api/products
- localhost:3001/api/tags
-
Can get by
ID
by adding the # after (Example:)- localhost:3001/api/categories/3
-
CREATE -
POST
- use the same http address as above
-
UPDATE -
PUT
- use the same http address as above
-
DELETE -
DELETE
- use the same http address as above
-
This project is covered under the following license:
If you have any questions, please email me at: knickler3@gmail.com
My GitHub page is: kwaters3