Giter Site home page Giter Site logo

vuex-workshop's Introduction

Vuex Workshop

This is the base application for the Vuex Workshop.

slides

Structure

.
├── config/                     # config files
│   └── ...
├── dist/                       # compiled files
│   └── ...
├── server/                     # server files
│   ├── api.js                  # api
│   ├── dev.js                  # dev server
│   └── index.js                # server entry point
├── src/
│   ├── api/                    # API services (Axios)
│   │   └── ...
│   ├── components/             # UI Components
│   │   └── ...
│   ├── entry/                  # bundle entries
│   │   ├── client.js           # client entry point
│   │   ├── app.js              # shared app entry point for server and client
│   │   └── server.js           # server server entry point
│   ├── router/                 # routing (maps and route components)
│   │   └── index.js            # router entry point
│   └── store/                  # store (Vuex state)
│   │   ├── module/             # store modules (state, actions and mutations)
│   │   │   └── ...
│   │   └── index.js            # store entry point
│   └── views/                  # UI Views
│       └── ...
├── static/                     # pure static assets
├── .babelrc                    # babel config
├── .editorconfig.js            # editor config
├── .eslintrc.js                # eslint config
├── .stylelintrc.js             # stylelint config
└── package.json                # build scripts and dependencies

Commands

  • Starts a Node.js local development server
    • yarn dev
    • npm run dev
  • Builds server bundle for SSR and client
    • yarn build
    • npm run build
  • Starts a Node.js server in production
    • yarn start
    • npm start
  • Run all linters
    • yarn lint
    • npm lint
  • Run eslint linter
    • yarn eslint
    • npm run eslint
  • Run stylelint linter
    • yarn stylelint
    • npm run stylelint

API

/api/product/list

Retrieve products [GET]

  • Response 200 (application/json)
    • Body
        { 
          "payload": [
            {
              "id": 1,
              "sku": "...",
              "title": "...",
              "desc": "...",
              "image": "...",
              "stocked": "....",
              "basePrice": 13.72,
              "price": 6.31
            },
            {
              "id": 2,
              "sku": "...",
              "title": "...",
              "desc": "...",
              "image": "...",
              "stocked": "....",
              "basePrice": 13.72,
              "price": 6.31
            }
          ]
        }

/api/product/:id

Retrieve product by id [GET]

  • Response 200 (application/json)
    • Body
        { 
          "payload": [
            {
              "id": 1,
              "sku": "...",
              "title": "...",
              "desc": "...",
              "image": "...",
              "stocked": "....",
              "basePrice": 13.72,
              "price": 6.31
            }
          ]
        }

/api/basket

Retrieve basket [GET]

Note if there is > 4 products in the basket then it will respond with 500 error

  • Response 200 (application/json)

    • Body
        { 
          "payload": [
            {
              "id": 32,
              "quantity": 2
            }
          ]
        }
  • Response 500 (application/json)

    • Body
        { 
          "error": {
            "message": "Server error"
          }
        }

Delete basket [DELETE]

  • Response 200 (application/json)
    • Body
        {
          "payload": []
        }

/api/basket/product/:id

Add product to basket [POST]

  • Request (application/json)

      {
        "quantity": "1"
      }
  • Response 200 (application/json)

    • Body
        { 
          "payload": [
            {
              "id": 32,
              "quantity": 2
            }
          ]
        }

Update product in basket [PATCH]

  • Request (application/json)

      {
        "quantity": "4"
      }
  • Response 200 (application/json)

    • Body
        { 
          "payload": [
            {
              "id": 32,
              "quantity": 4
            }
          ]
        }

Delete product in basket [DELETE]

  • Response 200 (application/json)
    • Body
        { 
          "payload": []
        }

vuex-workshop's People

Contributors

blake-newman 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.