Netherworld's Pretend Minibar
    Have ideas to improve npm?Join in the discussion! »

    swell-node

    4.0.3 • Public • Published

    Swell API library for NodeJS

    Swell is a customizable, API-first platform for powering modern B2C/B2B shopping experiences and marketplaces. Build and connect anything using your favorite technologies, and provide admins with an easy to use dashboard.

    Install

    npm install swell-node --save
    

    Connect

    const swell = require('swell-node');
    
    swell.init('my-store', 'secret-key');

    To connect to multiple stores in the same process, use swell.createClient():

    const swell = require('swell-node');
    
    const store1 = swell.createClient('my-store-1', 'secret-key-1');
    const store2 = swell.createClient('my-store-2', 'secret-key-2');

    Usage

    try {
      const products = await swell.get('/products', {
        active: true
      });
      console.log(products);
    } catch (err) {
      console.error(err);
    }

    Caching

    This library provides in-memory caching enabled by default, using a version protocol that means you don't have to worry about stale cache. Records that don't change too frequently, such as products, will always return from cache when possible.

    To disable caching behavior, use the option cache: false.

    swell.init('my-store', 'secret-key', {
      cache: false,
    });

    Documentation

    API reference: https://swell.store/docs/api

    Universal JavaScript client for Swell's Frontend API (Swell.js): https://swell.store/docs/js

    Contributing

    Pull requests are welcome

    License

    MIT

    Install

    npm i swell-node

    DownloadsWeekly Downloads

    296

    Version

    4.0.3

    License

    MIT

    Unpacked Size

    54.7 kB

    Total Files

    13

    Last publish

    Collaborators

    • avatar