Socket
Socket
Sign inDemoInstall

@spree/node-fetcher

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spree/node-fetcher

Node fetch fetcher for Spree api SDK.


Version published
Maintainers
4
Created
Source

Spree SDK in NodeJS using fetch

To use Spree SDK with fetch in NodeJS, install Node Fetch along with the fetcher using NPM:

npm install @spree/node-fetcher node-fetch

Set the fetcher to fetch:

const createFetchFetcher = require('@spree/node-fetcher/dist/server/index').default
const { makeClient } = require('@spree/storefront-api-v2-sdk')
const client = makeClient({
  host: 'http://localhost:3000',
  createFetcher: createFetchFetcher
})

Spree SDK in the browser using fetch

Modern web browsers include fetch natively. To use Spree SDK with native fetch, it's enough to set fetcherType to 'fetch' when creating the Spree SDK Client:

<script src="https://unpkg.com/@spree/storefront-api-v2-sdk@6.0.0/dist/client/index.js"></script>
<script src="https://unpkg.com/@spree/node-fetcher@1.0.0/dist/client/index.js"></script>

<script>
  const client = SpreeSDK.makeClient({
    host: 'http://localhost:3000',
    createFetcher: SpreeSDK.createFetchFetcher.default
  })
</script>

FAQs

Package last updated on 01 Dec 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc