1.3.1 • Published 6 years ago

@foxcommerce/api-js v1.3.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

FoxCommerce API.js

Overview

API.js is a JavaScript library that helps FoxCommerce customers create powerful, customized storefronts on top of the FoxCommerce API. It does this by creating an easy abstraction of available API operations and by providing convenient helper methods.

This API layer is framework agnostic as we don't to impose a framework decision such as React or Angular on customers.

API.js will be build in ES6 and transpiled to ES5. It won't use ES7 features.

API documentation

Spec

Principles:

  • The library should have simple method names that match core API methods, or simplifications or sugar on the core API.
  • It should make instantiation/authentication as simple as possible.
  • It should deal with Async, probably a Fetch/Promise-based model.
  • As a rule of thumb, .then() should be left to the implementation of the library ie. not in this codebase. Possible exception here is Auth section, storage of jwt tokens, handling oAuth redirects etc.

Debugging

You can log requests via settings DEBUG env variable to foxapi:

DEBUG=foxapi npm test

Developers

Before submitting your PR:

  • make sure flow and lint have no complaints. Run make test
  • to conform with our code style, run make fmt. This will prettify your code and fix any light-weight lint problems. Note: don't forget to commit the changes made by prettier

To facilitate lint fixing, consider running yarn fix-lint

Usage

import FoxCommAPI from `FoxComm/api-js`
const FxC = new FoxCommAPI({ args })  // args could include API domain & path data, public_key, etc

working draft