/buy-m3

This is an example e-commerce application mainly created to practice with Express.js, Sequelize and MySQL.

Primary LanguageJavaScriptMIT LicenseMIT

E-Commerce
💽Back End Application💾

📖About:

This API was created to perform CRUD operations on the simple elements that can occur on a standard E-Commerce project. This application has Products, Tags and Categories that interact with each other depending on the request.
Since the main focus was creating the API for this project, there is no front-end that allows the user to interact with it so, I've used Postman during testing and Insomnia for the demonstration.
This API uses Express.js to run the server and Sequelize to interact with the MySQL database.

📝Notes:

This was my first time creating a fully interactive back-end using MySQL. Sequelize makes it so much easier to interact with the database while keeping the code clean. I've noticed that once the API handles with PUT requests, it's best for the user to be inputting specifically the required fields otherwise, things can get messy and the user might come across with errors. Handling the errors and giving back descriptive messages is also very helpful on troubleshooting and for the user experience.
I used async & await while coding the routes, I also used try...catch for the first time. It definitely shortens the code while getting rid of call-back hell.

🔧Installation & Dependencies:

  1. Please clone this repo to your PC.
    Download ZIP
  • Alternatively, simply in the terminal;
    git clone https://github.com/kemaldemirgil/buy-m3
  1. Once it's located in your PC, before adding anything yet, please create the database from the MySQL shell. The schema is located in db/schema.sql.
    Create Database
  • Alternatively, copy the following:
    -- DROP DATABASE
    DROP DATABASE IF EXISTS ecommerce_db;
    
    -- CREATE DATABASE
    CREATE DATABASE ecommerce_db;
  1. After creating the database, please create a .env file to store your username, password and the database name using the following:
    DB_USER=
    DB_PW=
    DB_NAME=ecommerce_db
    Seed Database
  2. After creating the .env file, please seed the database by opening the terminal in the parent directory by running;
    npm run seed
    Seed Database
  3. Next, please install the dependencies by running the terminal in the parent directory.

    npm i
    Install Dependencies
  4. Finally, to start the application, please run the following on the main file:
    npm start
    Alternatively, to run it using nodemon,
    npm run watch

🚀Usage & Demo:

CRUD on Categories
CRUD on Tags
CRUD on Products

🧙Improvements:

Please contact me for any contributions or any input about this application, I would love to get some feedback!

Connect with me!

©️License:

Copyright © Kemal Demirgil. All rights reserved. Licensed under the MIT license.