New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zaneray/express-bigcommerce-middleware

Package Overview
Dependencies
Maintainers
0
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

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

  • 5.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
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 2 exported Components:

  • class BigCommerce - wraps the REST API for a single Big Commerce Storefront

  • BigCommerceRouter - ExpressJS router that provides standardized paths

  • caching - products and categories are going to get cached, /products and /categories The cache will be implemented in-memory and use session affinity to make sure a client browsing gets cached data

Running a stock express instance of the middleware

You can run a stock instance of the Express BigCommerce Middleware package by creating an Express server, instantiating a BigCommerce instance, and placing the instance on app.locals.bigCommerce as show below

const { BigCommerce, bigCommerceRouter } = require('@zaneray/express-bigcommerce-middleware');
const express = require("express");
const cookieParser = require('cookie-parser');
const bearerToken = require('express-bearer-token');
const expressip = require('express-ip');
const ExpressMiddleware = require('@zaneray/express-middleware');
const { get } = require('@zaneray/node-env');
const { logger } = require('@zaneray/gcp-node-logging');

const app = express();

const BC_CLIENT_ID = get('BC_CLIENT_ID');
const BC_ACCESS_TOKEN = get('BC_ACCESS_TOKEN');
const BC_STORE_HASH = get('BC_STORE_HASH');
const BC_CLIENT_SECRET = get('BC_CLIENT_SECRET');
const BC_CUSTOMER_TOKEN_APP_CLIENT_SECRET = get('BC_CUSTOMER_TOKEN_APP_CLIENT_SECRET');

app.locals.bigCommerce = new BigCommerce(BC_CLIENT_ID, BC_ACCESS_TOKEN, BC_STORE_HASH, BC_CLIENT_SECRET,BC_CUSTOMER_TOKEN_APP_CLIENT_SECRET);

app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(bearerToken());
app.use(expressip().getIpInfoMiddleware);

app.use([bigCommerceRouter]);

//anything not handled is a 404
app.use(ExpressMiddleware.fourOfour);

// standard error handler
app.use(ExpressMiddleware.catchAllErrorHandler);

//setup express configuration
app.set("trust.proxy", true);
//setup serving the site root
const HOST = get('HOST','0.0.0.0');
const PORT = get('PORT',3000);
// have the server listen for requests
app.listen(PORT, HOST);
logger.debug("Server listening on " + HOST + ":" + PORT);

FAQs

Package last updated on 11 Nov 2024

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