Switch branches/tags
usecase-bus@1.1.0 node-memory-leak-testing@2.0.1 node-memory-leak-testing@2.0.0 example-todomvc@1.1.0 example-todomvc@1.0.2 example-todomvc@1.0.1 example-todomvc-typescript@1.1.0 example-todomvc-flow@1.1.0 example-todomvc-flow@1.0.2 example-todomvc-flow@1.0.1 example-svg-feeling@1.1.0 example-svg-feeling@1.0.2 example-svg-feeling@1.0.1 example-shopping-cart@1.1.0 example-shopping-cart@1.0.2 example-shopping-cart@1.0.1 example-perf-node-memory-leak-testing@2.1.0 example-perf-benchmark@1.1.0 example-introduction@1.1.0 example-counter@1.1.0 example-counter@1.0.2 example-counter@1.0.1 benchmark@1.0.2 benchmark@1.0.1 almin@0.17.1 almin@0.17.0 almin@0.16.0 almin@0.15.3 almin@0.15.2 almin@0.15.1 almin@0.15.0 almin@0.14.0 almin@0.13.11 almin@0.13.10 almin@0.13.9 almin@0.13.8 almin@0.13.7 almin@0.13.6 almin@0.13.5 almin@0.13.4 almin@0.13.3 almin@0.13.2 almin@0.13.1 almin@0.13.0 almin@0.12.5 almin@0.12.4 almin@0.12.3 almin@0.12.2 almin@0.12.1 almin@0.12.0 @almin/usecase-bus@1.2.0 @almin/store-test-helper@1.1.1 @almin/store-test-helper@1.1.0 @almin/react-context@1.1.1 @almin/react-context@1.1.0 almin-react-container@0.7.1 almin-react-container@0.7.0 almin-react-container@0.6.4 almin-react-container@0.6.3 almin-react-container@0.6.2 almin-react-container@0.6.1 almin-react-container@0.6.0 almin-react-container@0.5.0 almin-react-container@0.4.0 almin-react-container@0.3.11 almin-react-container@0.3.10 almin-react-container@0.3.9 almin-react-container@0.3.8 almin-react-container@0.3.7 almin-react-container@0.3.6 almin-react-container@0.3.5 almin-react-container@0.3.4 almin-react-container@0.3.3 almin-react-container@0.3.2 almin-react-container@0.3.1 almin-react-container@0.3.0 almin-react-container@0.2.2 almin-react-container@0.2.1 almin-react-container@0.2.0 almin-logger@6.2.1 almin-logger@6.2.0 almin-logger@6.1.5 almin-logger@6.1.4 almin-logger@6.1.3 almin-logger@6.1.2 almin-logger@6.1.1 almin-logger@6.1.0 almin-logger@6.0.0 almin-logger@5.0.0 almin-logger@5.0.0-2 almin-logger@5.0.0-1 almin-logger@5.0.0-0 almin-logger@4.1.0 0.12.0-3 0.12.0-2 0.12.0-1 0.12.0-0 0.11.0 0.10.0 0.10.0-2
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
public
src
test
.babelrc
CHANGELOG.md
README.md
package.json
webpack.config.js
webpack.server.config.js

README.md

shopping-cart

Original example from:

Installation

npm install

Usage

# client-side rendering mode
npm start
open http://localhost:8080/
# server-side rendering mode
npm run start:ssr # Run after generated build/server.js 
open http://localhost:3000/server

Tests

npm tests

What's learn from this

shopping-cart example explain the reason we encourage you to normalize your data is to avoid duplication.

Domain Layer

  • Cart
    • Cart is shopping cart
  • Product
    • Product is catalog of product.
    • It has inventory level.
    • The Customer can pick up a ProductItem and add the item to the own Cart.
  • Customer
    • Customer is abstraction of user.
    • This example tread a single AnonymousCustomer. It means that exist one Customer in the global.

Value Object

  • ProductItem
    • ProductItem is a item object.

Store

shopping-cart example has three stores:

  • CartStore
    • Display Cart information
    • Total price
    • Count of items in the cart
  • ProductStore
    • Display Window for product
  • CustomerStore
    • current customer

AppLocator

  • Customer always is a single. So, AppLocator have global customer property.
    • It is easy to use customer.

Client <-> Server side rendering

This example has two mode.

  • Client-side rendering
    • Start with empty dom
  • Server-side rendering
    • Start with initialized dom
      • First paint is faster than client-side only
    • Continue as client-side rendering

See feat(example): support Server-Side Rendering in shopping cart by azu · Pull Request #200 · almin/almin.

License

MIT