![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@zaneray/express-bigcommerce-middleware
Advanced tools
Components for working with the BigCommerce API using Express and Node
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
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
Components for working with the BigCommerce API using Express and Node
We found that @zaneray/express-bigcommerce-middleware demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.