GithubHelp home page GithubHelp logo

x-oss-byte / swell-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from swellstores/swell-node

0.0 0.0 0.0 220 KB

Swell NodeJS library for building storefronts and checkouts with Swell ecommerce.

Home Page: https://swell.is

License: MIT License

JavaScript 100.00%

swell-node's Introduction

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

This library is intended for use with the Swell Backend API: https://developers.swell.is/backend-api

Contributing

Pull requests are welcome

License

MIT

swell-node's People

Contributors

awwit avatar dependabot[bot] avatar dimazhukovsky avatar ericingram avatar kyle-swell avatar patrickheneise avatar rodrigo-swell avatar swellmike avatar vstudenichnik-insoft 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.