Coder Social home page Coder Social logo

orm_ecommerce's Introduction

ORM_ECommerce

Description

This project uses Express.js, Node.js, dotenv.js, MySQL2.js, and Sequelize.js to implement an Express.js server that uses CRUD functions to service a MySQL database containing product data. It is meant to serve as an e-Commerce analog in order to learn how to use the MVC & ORM patterns in a production setting.

Table of Contents (Optional)

Installation

This project requires a working MySQL server.

At the command prompt, clone the repository by typing:

git clone [email protected]:error201/ORM_ECommerce.git

Navigate into the new folder and install the necessary npm packages by typing:

npm install

Enter your MySQL shell and run the schema.sql file to set up the MySQL database by typing:

SOURCE schema.js

When the database has been created, seed the database tables by navigating to the root folder and typing:

npm run seed

If no errors are found, start the Express.js server by typing:

npm run start

Usage

This project currently has no front-end, so all requests will have to be made to the server with a tester that can simulate HTTP requests. For this project, I used Insomnia.

A screenshot of the app

All requests follow the following format(s):

  • Products:

    • Get all Products: GET: http://localhost:3001/api/products/
    • Get a Product by ID: GET: http://localhost:3001/api/products/[product_id]
    • Create a Product: POST: http://localhost:3001/api/products/
      • The JSON request body will take the form:
      {
          "product_name": "Basketball",
          "price": 200.00,
          "stock": 3,
          "tagIds": [1, 2, 3, 4]
      }  
      
    • Edit a product: PUT: http://localhost:3001/api/products/[product_id]
    • Delete a product: DELETE: http://localhost:3001/api/products/[product_id]
  • Categories:

    • Get all Categories: GET: http://localhost:3001/api/categories/
    • Get a Category by ID: GET: http://localhost:3001/api/categories/[category_id]
    • Create a Category: POST: http://localhost:3001/api/categories/
      • The JSON request body will take the form:
      {
          "category_name": "Ties",
      }  
      
    • Edit a Category: PUT: http://localhost:3001/api/categories/[category_id]
    • Delete a Category: DELETE: http://localhost:3001/api/categories/[category_id]
  • Tags:

    • Get all Tags: GET: http://localhost:3001/api/tags/
    • Get a Tag by ID: GET: http://localhost:3001/api/tags/[tag_id]
    • Create a Tag: POST: http://localhost:3001/api/tags/
      • The JSON request body will take the form:
      {
          "tag_name": "Ties",
      }  
      
    • Edit a Tag: PUT: http://localhost:3001/api/tags/[tag_id]
    • Delete a tag: DELETE: http://localhost:3001/api/tags/[tag_id]

Credits

Several packages and/or libraries were used for this project:

License

This project is covered by the MIT license. Please see LICENSE for details.

GitHub


Badges

GitHub repo file count

GitHub commit activity

How to Contribute

Feel free to fork and/or clone this repository to contribute.

orm_ecommerce's People

Contributors

error201 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.