Coder Social home page Coder Social logo

elizabetholsavsky / e-commerce-back-end Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 152 KB

This application was created as part of a UT Full Stack Coding Bootcamp challenge. Given the starter code of a working Express.js API, code was configured to use Sequelize to interact with a MySQL database.

License: MIT License

JavaScript 100.00%
bootcamp-challenge dotenv e-commerce e-commerce-back-end insomnia mysql mysql2 nodejs nodemon sequelize

e-commerce-back-end's Introduction

E-Commerce Back End

License: MIT Node.js Badge MySQL Badge Sequelize Badge .ENV Badge Nodemon Badge Insomnia Badge

Description

This application was created as part of a UT Full Stack Coding Bootcamp challenge. Given the starter code of a working Express.js API, code was configured to use Sequelize to interact with a MySQL database.

Code syncs Sequelize models to a MySQL database on the server start, includes column definitions for all four models and model associations, and provides the following GET, POST, PUT, and DELETE routes:

Category

  • GET all categories, GET a single category by ID, POST(create) a new category, PUT(update) and existing category by ID, and DELETE an existing category by ID.

Tag

  • GET all tags, GET a single tag by ID, POST(create) a new tag, PUT(update) an existing tag by ID, and DELETE an existing tag by ID.

Product (including ProductTag)

  • GET all products, GET products by ID, and DELETE products by ID. POST(create) and PUT(update) product routes were provided in starter code.

Watch video to see application set-up in VSCode and demonstration all API routes' endpoints using Insomnia:

E-Commerce.Back.End.mov

Table of Contents

Installation

  • Check if you have Node.js installed by typing node -v in your command line. If node is not installed, visit the Node.js website to install.
  • Next, clone this project repository to your computer.
  • Use the command npm i to install dependencies.
  • Create a file in the root directory titled .env and include database name and personal MySQL login information:
DB_NAME='YOUR DATABASE NAME'
DB_USER='YOUR USERNAME'
DB_PW='YOUR PASSWORD'
  • Open MySQL with command mysql -u root -p and enter your personal MySQL password.
  • Create databse with command source schema.sql. Log out of MySQL with command \q.
  • Seed database with command npm run seed.

Usage

  • Start server with command npm start.
  • Alternatively, start server with Nodemon (and restart server automatically when making changes to code) with command npm run watch.
  • Access API routes with Insomnia using the following endpoints:
CATEGORY TAG PRODUCT
GET (ALL), POST(CREATE) http://localhost:3001/api/categories/ http://localhost:3001/api/tags/ http://localhost:3001/api/products/
GET (BY ID), PUT(UPDATE), DELETE http://localhost:3001/api/categories/:id http://localhost:3001/api/tags/:id http://localhost:3001/api/products/:id
  • Make POST and PUT requests with the following JSON body formats:

CATEGORY

{ 
"categoryName": "STRING INPUT" 
}

TAG

{ 
"tagName": "STRING INPUT" 
}

PRODUCT

{ 
"product_name": "STRING INPUT",   
"price": DECIMAL INPUT,   
"stock": INTEGER INPUT,   
"tagIds": INTEGER INPUT
}

License

MIT License

Contributing

Starter code was provided by Xander Rapstine (Xandromus) and UT Austin Boot Camps.

Tables in README created using table-magic by Steve GunTrip (stevecat).

Contact

e-commerce-back-end's People

Contributors

elizabetholsavsky avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.