Socket
Socket
Sign inDemoInstall

@zaneray/express-bigcommerce-middleware

Package Overview
Dependencies
245
Maintainers
16
Versions
97
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @zaneray/express-bigcommerce-middleware

Components for working with the BigCommerce API using Express and Node


Version published
Weekly downloads
19
decreased by-96.76%
Maintainers
16
Created
Weekly downloads
 

Readme

Source

ZaneRay BigCommerce Middleware package

Description

The ZaneRay Express BigCommerce Middleware package contains components for working with the BigCommerce API in a Node environment. There are three main component areas.

  • BigCommerce Storefront Configuration
  • BigCommerce Middleware API Routing
  • BigCommerce API Services

Running a stock express instance of the middleware

You can run a stock instance of the Express BigCommerce Middleware package by creating a project with a package.json like the following

{
  "name": "express-bigcommerce-middleware-example",
  "version": "0.0.1",
  "description": "Example for running the stock ZaneRay BigCommerce Middleware express instance",
  "author": "The ZaneRay Group",
  "scripts": {
    "start": "node node_modules/@zaneray/express-bigcommerce-middleware/lib/index.js",
    "build": "echo nothing to see here, move along..."
  },
  "dependencies": {
    "@zaneray/express-bigcommerce-middleware": "4.2.0"
  }
}

Required Environment variables

CORS_WHITELIST=<comma delimited list of allows origins, e.g. http://www.mysite.com,https://www.mysite.com>
PORT=<port that the instance should listen on, 3000 is the default>
CUSTOMER_TOKEN_APP_CLIENT_SECRET=<BigCommerce Customer Token App Client Secret>
# BigCommerce Store 1 setup
BC_CLIENT_ID1=<store 1 oauth client id>
BC_ACCESS_TOKEN1=<store 1 oauth access token>
BC_STORE_HASH1=<store 1 bigcommerce store hash>
BC_PRODUCT_CACHE_TIMEOUT_SECONDS1=<store 1 product cache timeout in seconds>
# BigCommerce Store 2 setup
BC_CLIENT_ID2=<store 2 oauth client id>
BC_ACCESS_TOKEN2=<store 2 oauth access token>
BC_STORE_HASH2=<store 2 bigcommerce store hash>
BC_PRODUCT_CACHE_TIMEOUT_SECONDS2=<store 2 product cache timeout in seconds>
# Continue with as many stores as you wish using the naming convention above incrementing the trailing number
# in each environment variable.

Database Configuration

A MySQL Pool client exists in ./db/pool.js and can be shared across different database files. The intent was to create a single PoolManager (client) and then load/init that file where it is used. The products-service.js file has an example of this being loaded at the top, based on an environment variable named DB_NAME existing.

For a localhost, or TCP database, use the following properties
DB_HOST=localhost:3306
DB_USER=datase_user_name
DB_PASS=database_user_password
DB_NAME=default_schema
For a Cloud SQL Database, use the following properties

Unix sockets are used to create the connection. GCP Documentation Here The CLOUD_SQL_CONNECTION_NAME property is listed on the Overview page of the Instance in GCP

CLOUD_SQL_CONNECTION_NAME=project-id:project-region:cloud-sql-instance-name
DB_USER=datase_user_name
DB_PASS=database_user_password
DB_NAME=default_schema

Run the instance with the following commands

export NODE_ENV=development
npm run start

FAQs

Last updated on 10 May 2024

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