8000 GitHub - elizabetholsavsky/e-commerce-back-end: 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.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Notifications You must be signed in to change notification settings

elizabetholsavsky/e-commerce-back-end

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0