Socket
Socket
Sign inDemoInstall

swell-node

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    swell-node

Swell API library for NodeJS


Version published
Weekly downloads
1.1K
increased by17.77%
Maintainers
1
Install size
84.1 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 22 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc