Giter Club home page Giter Club logo

store-front-backend's Introduction

Store Front API

Description

This project is an API that provide all the functionalities needed for an online store

API Endpoints

  1. Products

    1. Index (GET /products)
    2. Show (GET /products/:id)
    3. Create [token required] (POST /products)
    4. Top 5 most popular products (GET /products/featured)
    5. Products by category (args: product category) (GET /products/category/:category)
  2. Users

    1. Index [token required] (GET /users)
    2. Show [token required] (GET /users/:id)
    3. Create N[token required] (POST /users)
  3. Orders

    1. Create Order (POST /orders)
    2. Close Order (PUT /orders/:orderId/close)
    3. Current Order by user (args: user id)[token required] (GET /orders/current/:userId)
    4. Completed Orders by user (args: user id)[token required](GET /orders/completed/:userId)

ERD

ERD

Table of Contents

Installation

  1. Open your terminal and run the following commands:

    1. git clone https://github.com/AhmedMohammed3/store-front-backend.git
    2. cd store-front-backend
    3. npm i
  2. Create a file called .env with the following keys and fill it with your own data:

    1. PORT
    2. DB_HOST
    3. DB_USER
    4. DB_PASS
    5. DB_NAME=store_front
    6. DB_TEST_NAME=store_front_test
    7. JWT_SECRET
    8. BCRYPT_PEPPER
    9. BCRYPT_SALT
    10. ENV=dev
  3. Run the following set of commands to create your databases

    1. psql -U {POSTGRES_USER}
    2. CREATE DATABASE store_front;
    3. CREATE DATABASE store_front_test;
    4. \q
  4. Run the following command to migrate tables:

    1. npm run migrate
  5. Run the following command to seed the database:

    1. psql -U {POSTGRES_USER} -d store_front -a -f ./seeds/seed.sql

NOTES

NOTE That DB is running on the default port 5432 so you don't need to add it to the .env file.

How To Run The Server

  1. Run the following command to start the server:
    1. npm run start

Contribute

Adding new features or fixing bugs

  1. Open your terminal and clone the repository
    git clone https://github.com/AhmedMohammed3/store-front-backend.git
  2. Create your branch
    git checkout -b {YOUR_BRANCH_NAME}
  3. run npm run dev to start development server (It's automatically building and restarting).
  4. Make your edits and review it well.
  5. Commit your changes with appropriate message. Follow these git style guides
    git commit -m {YOUR_COMMIT_MSG}
  6. Push your changes
    git push origin {YOUR_BRANCH_NAME}
  7. Create a pull request

store-front-backend's People

Contributors

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