resetmerlin / react-shopping-cart

โš›๏ธ React Shopping Basket Application ๐Ÿ›’

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shopping basket

React & Redux Desktop shopping basket application

๐Ÿš€ Getting Started

Composes a large number of components into pages and manages complexity.

โœ” Implement the ๏ธ 'Desktop Target' web app and think about the 'UI/UX considering revisiting' without interruption leading to purchases. โœ” Use 'Redux' based on 'Flux Architecture' for ๏ธ status management. โœ” Consider switching multiple pages using the ๏ธ 'Router'. โœ” Refer to the ๏ธ Baemin Chamber of Commerce Service


๐Ÿ•‹ How to run the Server

  • At first run
# npm
cd server

npm install

npm run server
  • On subsequent runs
# npm
npm run server

๐Ÿ•‹ How to run the Client

  • At first run
# npm
cd client

npm install

npm run dev
  • On subsequent runs
# npm
npm run dev

๐Ÿ“ API Specification

๐ŸŒ baseUrl

http://localhost:3003

๐ŸŽ Product

Product List Inquiry

method uri
GET /products
{
  "response": [
    {
      "id": 1,
      "price": 10000,
      "name": "์น˜ํ‚จ",
      "imageUrl": "http://example.com/chicken.jpg"
    },
    {
      "id": 2,
      "price": 20000,
      "name": "ํ”ผ์ž",
      "imageUrl": "http://example.com/pizza.jpg"
    }
  ]
}

Add a product

method uri
POST /products
{
  "requestBody": {
    "products": {
      "price": 10000,
      "name": "์น˜ํ‚จ",
      "imageUrl": "http://example.com/chicken.jpg"
    }
  }
}

Product Single Inquiry

method uri
GET /products/{id}
{
  "response": {
    "id": 1,
    "price": 10000,
    "name": "์น˜ํ‚จ",
    "imageUrl": "http://example.com/chicken.jpg"
  }
}

Product Single Delete

method uri
DELETE /products/{id}
{
  "response": {}
}

๐Ÿ›’ Shopping basket

Check shopping basket item list

method uri
GET /carts
{
  "response": {
    "id": 1,
	  "product": {
			"name": "test",
			"price": 1234,
			"imageUrl": "test.com",
			"id": 1
		},
	},
	{
    "id": 5,
		"product": {
			"name": "tes11111t",
			"price": 1234,
			"imageUrl": "test.com",
			"id": 10
		}
	},
}

Add shopping basket items

method uri
POST /carts
{
  "requestBody": {
    "product": {
      "id": 10,
      "name": "tes11111t",
      "price": 1234,
      "imageUrl": "test.com"
    }
  }
}

Single Delete Shopping Basket Item

method uri
DELETE /carts/{cartId}
{
  "response": {}
}

๐Ÿ—’ Order

Add Order (to place an order)

method uri
POST /orders
{
  "requestBody": {
    "orderDetails": [
      {
        "id": 1,
        "price": 10000,
        "name": "์น˜ํ‚จ",
        "imageUrl": "http://example.com/chicken.jpg",
        "quantity": 5
      },
      {
        "id": 2,
        "price": 20000,
        "name": "ํ”ผ์ž",
        "imageUrl": "http://example.com/pizza.jpg",
        "quantity": 3
      }
    ]
  }
}

Order list (details) inquiry

method uri
GET /orders
{
  "response": [
    {
      "id": 1,
      "orderDetails": [
        {
          "id": 1,
          "price": 10000,
          "name": "์น˜ํ‚จ",
          "imageUrl": "http://example.com/chicken.jpg",
          "quantity": 5
        },
        {
          "id": 2,
          "price": 20000,
          "name": "ํ”ผ์ž",
          "imageUrl": "http://example.com/pizza.jpg",
          "quantity": 3
        }
      ]
    },
    {
      "id": 2,
      "orderDetails": [
        {
          "id": 1,
          "price": 10000,
          "name": "์น˜ํ‚จ",
          "imageUrl": "http://example.com/chicken.jpg",
          "quantity": 5
        },
        {
          "id": 2,
          "price": 20000,
          "name": "ํ”ผ์ž",
          "imageUrl": "http://example.com/pizza.jpg",
          "quantity": 3
        }
      ]
    }
  ]

Order Single Lookup

method uri
GET /orders/{id}
{
  "response": {
    "id": 1,
    "orderDetails": [
      {
        "id": 1,
        "price": 10000,
        "name": "์น˜ํ‚จ",
        "imageUrl": "http://example.com/chicken.jpg",
        "quantity": 5
      },
      {
        "id": 2,
        "price": 20000,
        "name": "ํ”ผ์ž",
        "imageUrl": "http://example.com/pizza.jpg",
        "quantity": 3
      }
    ]
  }
}

์žฅ๋ฐ”๊ตฌ๋‹ˆ

React & Redux ๋ฐ์Šคํฌํƒ‘ ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜

๐Ÿš€ Getting Started

๋‹ค์ˆ˜์˜ ์ปดํฌ๋„ŒํŠธ๋ฅผ ํŽ˜์ด์ง€๋กœ ๊ตฌ์„ฑํ•˜๊ณ  ๋ณต์žกํ•ด์ง„ ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

โœ”๏ธ ๋ฐ์Šคํฌํƒ‘ ํƒ€๊ฒŸ์˜ ์›น ์•ฑ์„ ๊ตฌํ˜„ํ•˜๋ฉฐ ๊ตฌ๋งค๋กœ ์ด์–ด์ง€๋Š” ๊ฒƒ์— ๋Š๊น€์ด ์—†๊ณ  ์žฌ๋ฐฉ๋ฌธ์„ ๊ณ ๋ คํ•œ UI/UX์— ๋Œ€ํ•ด ๊ณ ๋ฏผํ•ด๋ด…๋‹ˆ๋‹ค.
โœ”๏ธ ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•ด Flux Architecture ๊ธฐ๋ฐ˜์˜ Redux๋ฅผ ํ™œ์šฉํ•ฉ๋‹ˆ๋‹ค.
โœ”๏ธ Router๋ฅผ ํ™œ์šฉํ•ด ์—ฌ๋Ÿฌ ํŽ˜์ด์ง€ ์ „ํ™˜์„ ๊ณ ๋ คํ•ฉ๋‹ˆ๋‹ค.
โœ”๏ธ ๋ฐฐ๋ฏผ์ƒํšŒ ์„œ๋น„์Šค ์ฐธ๊ณ 


๐Ÿ•‹ Server ์‹คํ–‰ ๋ฐฉ๋ฒ•

react-shopping-cart/client ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ์‹คํ–‰ํ•ด์ฃผ์„ธ์š”.

  • ์ตœ์ดˆ ์‹คํ–‰ ์‹œ
# npm
npm run server:first

# yarn
yarn server:first
  • ์ดํ›„ ์‹คํ–‰ ์‹œ
# npm
npm run server

# yarn
yarn server

๐Ÿ“ API ๋ช…์„ธ

๐ŸŒ baseUrl

http://localhost:3003

๐ŸŽ ์ƒํ’ˆ

์ƒํ’ˆ ๋ชฉ๋ก ์กฐํšŒ

method uri
GET /products
{
  "response": [
    {
      "id": 1,
      "price": 10000,
      "name": "์น˜ํ‚จ",
      "imageUrl": "http://example.com/chicken.jpg"
    },
    {
      "id": 2,
      "price": 20000,
      "name": "ํ”ผ์ž",
      "imageUrl": "http://example.com/pizza.jpg"
    }
  ]
}

์ƒํ’ˆ ์ถ”๊ฐ€

method uri
POST /products
{
  "requestBody": {
    "products": {
      "price": 10000,
      "name": "์น˜ํ‚จ",
      "imageUrl": "http://example.com/chicken.jpg"
    }
  }
}

์ƒํ’ˆ ๋‹จ์ผ ์กฐํšŒ

method uri
GET /products/{id}
{
  "response": {
    "id": 1,
    "price": 10000,
    "name": "์น˜ํ‚จ",
    "imageUrl": "http://example.com/chicken.jpg"
  }
}

์ƒํ’ˆ ๋‹จ์ผ ์‚ญ์ œ

method uri
DELETE /products/{id}
{
  "response": {}
}

๐Ÿ›’ ์žฅ๋ฐ”๊ตฌ๋‹ˆ

์žฅ๋ฐ”๊ตฌ๋‹ˆ ์•„์ดํ…œ ๋ชฉ๋ก ์กฐํšŒ

method uri
GET /carts
{
  "response": {
    "id": 1,
	  "product": {
			"name": "test",
			"price": 1234,
			"imageUrl": "test.com",
			"id": 1
		},
	},
	{
    "id": 5,
		"product": {
			"name": "tes11111t",
			"price": 1234,
			"imageUrl": "test.com",
			"id": 10
		}
	},
}

์žฅ๋ฐ”๊ตฌ๋‹ˆ ์•„์ดํ…œ ์ถ”๊ฐ€

method uri
POST /carts
{
  "requestBody": {
    "product": {
      "id": 10,
      "name": "tes11111t",
      "price": 1234,
      "imageUrl": "test.com"
    }
  }
}

์žฅ๋ฐ”๊ตฌ๋‹ˆ ์•„์ดํ…œ ๋‹จ์ผ ์‚ญ์ œ

method uri
DELETE /carts/{cartId}
{
  "response": {}
}

๐Ÿ—’ ์ฃผ๋ฌธ

์ฃผ๋ฌธ ์ถ”๊ฐ€(์ฃผ๋ฌธํ•˜๊ธฐ)

method uri
POST /orders
{
  "requestBody": {
    "orderDetails": [
      {
        "id": 1,
        "price": 10000,
        "name": "์น˜ํ‚จ",
        "imageUrl": "http://example.com/chicken.jpg",
        "quantity": 5
      },
      {
        "id": 2,
        "price": 20000,
        "name": "ํ”ผ์ž",
        "imageUrl": "http://example.com/pizza.jpg",
        "quantity": 3
      }
    ]
  }
}

์ฃผ๋ฌธ ๋ชฉ๋ก(๋‚ด์—ญ) ์กฐํšŒ

method uri
GET /orders
{
  "response": [
    {
      "id": 1,
      "orderDetails": [
        {
          "id": 1,
          "price": 10000,
          "name": "์น˜ํ‚จ",
          "imageUrl": "http://example.com/chicken.jpg",
          "quantity": 5
        },
        {
          "id": 2,
          "price": 20000,
          "name": "ํ”ผ์ž",
          "imageUrl": "http://example.com/pizza.jpg",
          "quantity": 3
        }
      ]
    },
    {
      "id": 2,
      "orderDetails": [
        {
          "id": 1,
          "price": 10000,
          "name": "์น˜ํ‚จ",
          "imageUrl": "http://example.com/chicken.jpg",
          "quantity": 5
        },
        {
          "id": 2,
          "price": 20000,
          "name": "ํ”ผ์ž",
          "imageUrl": "http://example.com/pizza.jpg",
          "quantity": 3
        }
      ]
    }
  ]

์ฃผ๋ฌธ ๋‹จ์ผ ์กฐํšŒ

method uri
GET /orders/{id}
{
  "response": {
    "id": 1,
    "orderDetails": [
      {
        "id": 1,
        "price": 10000,
        "name": "์น˜ํ‚จ",
        "imageUrl": "http://example.com/chicken.jpg",
        "quantity": 5
      },
      {
        "id": 2,
        "price": 20000,
        "name": "ํ”ผ์ž",
        "imageUrl": "http://example.com/pizza.jpg",
        "quantity": 3
      }
    ]
  }
}

About

โš›๏ธ React Shopping Basket Application ๐Ÿ›’


Languages

Language:TypeScript 51.7%Language:HTML 28.4%Language:CSS 8.6%Language:SCSS 8.6%Language:JavaScript 2.8%