Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce-Management

A back end for an e-commerce website built with Express.js, Sequelize, MySQL, and tested with Insomnia.

JavaScript Node.js Express.js MySQL2 Sequelize Insomnia npm

Description

This project is a back end solution for managing an e-commerce website. It's built using Express.js for handling HTTP requests, Sequelize as the ORM tool for interacting with a MySQL database, and utilizes RESTful API routes for CRUD operations on product categories, individual products, and associated tags.

The application features well-defined models for categories, products, tags, and their associations, creating an organized database schema. It includes a seed script to easily populate the database with test data for testing and development purposes.

Table of Contents

Features

  • Seamless management of product categories, products, and tags.
  • Efficient API routes for creating, updating, and deleting data.
  • Robust database schema and models with associations between categories, products, and tags.
  • Secure storage of sensitive data, such as MySQL credentials, using environment variables with the dotenv package.
  • Convenient seed script (npm run seed) for populating the database with test data, facilitating testing and development.

Installation

Follow these steps to set up and use the E-Commerce-Management on your local machine:

  • Clone the repository: git clone https://github.com/bahossdev/E-Commerce-Management.git
  • Install the required libraries: npm install
  • To connect to your MySQL database, create a .env file in the root directory of the project, including the following:
    DB_NAME = database_name
    DB_USER = your username
    DB_PASSWORD = your password
    
  • Create a MySQL database using the provided schema.sql file.
  • Seed the database with test data: npm run seed
  • Run the app using: npm start

Now, you're ready to efficiently manage your e-commerce platform.

How to Use

  1. Ensure the application is running by executing npm start.

  2. Use Insomnia Core or a similar tool to test API routes.

  3. Open API different routes for categories, products, or tags to view data in a formatted JSON. Here are some examples:

    • GET All Categories:
      GET http://localhost:3001/api/categories
    • GET Single Product:
      GET http://localhost:3001/api/products/1
    • POST Create Category:
      POST http://localhost:3001/api/categories
      Content-Type: json
      {
        "category_name": "Electronics"
      }
    • PUT Update Product:
      PUT http://localhost:3001/api/products/1
      Content-Type: json
      
      {
        "product_name": "Updated Product",
        "price": 49.99
      }
    • DELETE Remove Tag from Product:
      DELETE http://localhost:3001/api/products/1/tags/2
  4. Test API POST, PUT, and DELETE routes for all other routes (categories, products, and tags) to create, update, and delete data in the database.

NOTE: In case of any errors or if you'd like to cancel a task press ctrl+c (^C).

Built With

  • JavaScript
  • Node.js
  • Express.js
  • MySQL2
  • Sequelize
  • Insomnia
  • npm

Credits

To create this application, I referenced documentation for MySQL, Express.js, npm, Insomnia [add more]. Additionally, I drew insights from class activities and consulted resources on MDN, W3Schools, Stack Overflow, and similar educational platforms. The starter code can be found at this link.

License

Please refer to the LICENSE in the repo.

Walkthrough Video

Link to Walkthrough Video demonstrating the functionality of the E-Commerce-Management:

Repository

Questions

If you have any questions or need further assistance, feel free to reach out @bahoss.dev@gmail.com.

Screenshots

  • Insomnia: GET All Categories: screenshot1

  • Insomnia: GET Single Product: screenshot2

About

A back end for e-commerce website using the latest technologies

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages