Git Product home page Git Product logo

js-shoppinglist-deep-project's Introduction

쇼핑몰 미니게임 클론코딩

클론 프로젝트 참고

쇼핑몰 미니게임


구현할 기능 목록

  • 전체 상품 List 보여주기
  • 상품 카테고리 List 정렬
  • 상품 색깔별 List 정렬

Data

{
    "items": [
        {
            "type": "tshirt", 
            "gender": "female", 
            "size": "large", 
            "color": "pink", 
            "img": "../img/pink_t.png"
        },
        {
            "type": "pants", 
            "gender": "male", 
            "size": "small", 
            "color": "blue", 
            "img": "../img/blue_p.png"
        },
        {
            "type": "pants", 
            "gender": "male", 
            "size": "large", 
            "color": "yellow", 
            "img": "../img/yellow_p.png"
        },
        {
            "type": "skirt", 
            "gender": "female", 
            "size": "small", 
            "color": "pink", 
            "img": "../img/pink_s.png"
        },
        {
            "type": "tshirt", 
            "gender": "female", 
            "size": "small", 
            "color": "pink", 
            "img": "../img/pink_t.png"
        },
        {
            "type": "skirt", 
            "gender": "female", 
            "size": "small", 
            "color": "yellow", 
            "img": "../img/yellow_s.png"
        },
        {
            "type": "pants", 
            "gender": "female", 
            "size": "large", 
            "color": "pink", 
            "img": "../img/pink_p.png"
        },
        {
            "type": "tshirt", 
            "gender": "male", 
            "size": "large", 
            "color": "yellow", 
            "img": "../img/yellow_t.png"
        },
        {
            "type": "tshirt", 
            "gender": "male", 
            "size": "large", 
            "color": "blue", 
            "img": "../img/blue_t.png"
        }
    ]
}

Note

fetch 활용

자바스크립트를 사용하면 필요할 때 서버에 네트워크 요청을 보내고 새로운 정보를 받아오는 일을 할 수 있습니다.

  • fetch함수를 사용하면 리소스를 비동기로 요청할 수 있습니다.
  • fetch를 호출하면 브라우저는 요청을 보내고 Promise 객체를 반환합니다. 요청이 완료되면 성공 여부에 상관없이 Promise가 resolved 되어 Response 객체가 반환됩니다. (404, 500 같은 경우와 같은 응답 코드를 받은 경우는 에러를 일으키지 않습니다.)
  • HTTP 요청이 완료되지 못한 상태라면 Promise가 rejected 됩니다. 이 경우 catch 메서드를 사용하여 에러를 처리할 수 있습니다. (네트워크 문제 및 존재하지 않는 사이트에 대한 요청에 해당합니다.)
  • Response 객체는 응답에 대한 정보를 담고 있습니다. ok, status 속성을 이용하여 응답 성공 여부를 확인할 수 있습니다.
fetch('http://example.com/movies.json')
  .then(function(response) {
    return response.json();
  })
  .then(function(myJson) {
    console.log(JSON.stringify(myJson));
  });

예제

function loadItems() {
    return fetch('data/data.json')
    .then(response => response.json())
    .then(json => json.items);
}

js-shoppinglist-deep-project's People

Contributors

jong-pang 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.