2.2.1 • Published 4 years ago

@ecomplus/storefront-router v2.2.1

Weekly downloads
350
License
MIT
Repository
github
Last release
4 years ago

E-Com Plus Storefront Router

Publish CodeFactor npm version License MIT

SPA/SSR router for E-Com Plus storefront

CHANGELOG

Usage

The @ecomplus/storefront-router package may be used for:

  • List all products, brands, categories and collections pages (URL paths) for prerenderization/SSR;
  • Based on URL path, get document body (product, brand, category, collection) on browser or server side to render the page markup;

It's available for both Node.js and browser environments.

Example

const router = new EcomRouter()
// Simple example resolving all routes
router.list()
  .then(routes => {
    routes.forEach(route => {
      console.log(route.resource)
      router.resolve(route)
        .then(context => {
          console.log(context.body)
        })
        .catch(error => { throw error })
    })
  })
  .catch(error => {
    console.error(error)
    if (error.response) {
      console.log(error.response)
    }
  })

Installation

It may require and doesn't include core-js (optional) and @ecomplus/utils (peer dependency).

Webpack

npm i --save core-js @ecomplus/utils @ecomplus/storefront-router

Node.js

npm i --save @ecomplus/utils @ecomplus/storefront-router

CDN

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/storefront-router/dist/ecom-router.var.min.js"></script>

When importing from CDN, ecomUtils and ecomClient libraries must be included separately and available on window scope.

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago