Skip to content

jroller33/E-Commerce-Site

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Site Back-End

License: MIT

Description

This is the backend for an e-commerce site. It has a node.js server, express.js API, MySQL database, and sequelize ORM.

Table of Contents

Usage

  1. Clone the repo: https://github.com/jroller33/E-Commerce-Site.git
  2. Create a .env file in the main directory, and put your mysql credentials inside it in this format:
DB_NAME='ecommerce_db'
DB_USER='username'
DB_PASSWORD='password'

  1. Run:

    • node: npm i
    • mysql: SOURCE ./db/schema.sql
    • node: npm run seed
    • node: node server.js
  2. Server should be listening on http://localhost:3001/

  3. Test the following API Routes in Insomnia:

    • GET /api/products

    • GET /api/products/:id

    • POST /api/products

    • PUT /api/products/:id

    • DELETE /api/products/:id

    • GET /api/categories

    • GET /api/categories/:id

    • POST /api/categories

    • PUT /api/categories/:id

    • DELETE /api/categories/:id

    • GET /api/tags

    • GET /api/tags/:id

    • POST /api/tags

    • PUT /api/tags/:id

    • DELETE /api/tags/:id

    Req body for POST /api/products, PUT /api/products/:id 
        {
            "product_name": "Test Product",
            "price": 100.00,
            "stock": 5,
            "tagIds": [1, 2, 3, 4]
        }

    Req body for POST /api/categories, PUT /api/categories/:id 
        {
            "category_name": "Test Category"
        }

    Req body for POST /api/tags, PUT /api/tags/:id
        {
            "tag_name": "New tag"
        }

Demo Video

https://youtu.be/WwZyolK3yYc

Contribution

You can contribute here.

License

This project is licensed under the MIT License.

Contact

GitHub

Releases

No releases published

Packages

No packages published