Giter Club home page Giter Club logo

fast-shopping-api's Introduction

Fast Shopping

You can visit the API at this URL and checkout this routes

The frontend was created with React and some other technologies. It is a simple shopping cart.. Now you can clone and install this repo and then start the client

TECHNOLOGIES

FullStack
Languages JavaScript
Frontend React Js React-Redux Redux-Persist React-Routing Styled-Components Material UI
Backend NodeJs Express SQL Sequelize MySQL

First Steps

  • Open a console and clone this repo
  • if you want to use the api in localhost then run npm install, npm start and chage the API_PATH in the config file

This project is running in localhost at port 4000.

Populating db

In order to charge some data to display in client side you have 3 ways of doing:

1 - By the SQL sample scripts that I will forward provide.

2 - Clicking on the following button to access to the run in postman collection of endpoints

Run in Postman

3 - Using a seeder that i create to automatize the process, yo will find some comments in the app.js file in api side. This option will start a bulk creation o the mocked data (Categories, Products and a function tha relate this to models).

I hope you enjoy navigating as much as i do coding 😎

ER Diagram

image

!(Relations)

SQL Scripts

CREATE DATABASE `fastshopping`
/*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
CREATE TABLE `categories` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
INSERT INTO `fastshopping`.`categories`
(`id`,
`name`,
`createdAt`,
`updatedAt`)
VALUES
(
  id: ,
  name: ,
  createdAt: ,
  updatedAt:
);
CREATE TABLE `products` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `price` decimal(9,2) NOT NULL,
  `stock` int NOT NULL,
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
INSERT INTO `fastshopping`.`products`
(`id`,
`categoriesId`,
`name`,
`description`,
`price`,
`stock`,
`createdAt`,
`updatedAt`)
VALUES
(
  id: ,
  categoriesId: ,
  name: ,
  description: ,
  price: ,
  stock: ,
  createdAt: ,
  updatedAt:
);
CREATE TABLE `orders` (
  `id` int NOT NULL AUTO_INCREMENT,
  `total` decimal(9,2) NOT NULL,
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `orderlines` (
  `id` int NOT NULL AUTO_INCREMENT,
  `productsId` int NOT NULL,
  `orderId` int NOT NULL,
  `subTotal` decimal(9,2) NOT NULL,
  `quantity` int DEFAULT NULL,
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `productsId` (`productsId`),
  KEY `orderId` (`orderId`),
  CONSTRAINT `orderlines_ibfk_1` FOREIGN KEY (`productsId`) REFERENCES `products` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `orderlines_ibfk_2` FOREIGN KEY (`orderId`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `category_product` (
  `createdAt` datetime NOT NULL,
  `updatedAt` datetime NOT NULL,
  `productId` int NOT NULL,
  `categoryId` int NOT NULL,
  PRIMARY KEY (`productId`,`categoryId`),
  KEY `categoryId` (`categoryId`),
  CONSTRAINT `category_product_ibfk_1` FOREIGN KEY (`productId`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `category_product_ibfk_2` FOREIGN KEY (`categoryId`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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.