![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.
unleash-express
Advanced tools
unleash-client that helps persisting feature toggle results over Express.js
You will need express and cookie-parser:
const express = require('express');
const app = express();
app.use(cookieParser());
const { initialize } = require('unleash-client');
const unleash = initialize(...);
const { UnleashExpress } = require('unleash-express');
const unleashExpress = new UnleashExpress(unleash, options);
Available options:
cookieName
(string): The name of the cookie to persist the result values of each feature toggle. Defaults to 'unleash'cookieOptions
(object): Additionl options for the cookie like expires
or maxAge
. No default.app.use(cookieParser());
app.use(unleashExpress.middleware()); // This will allow reading/setting the cookies
Ask unleash-client
for the value of a feature as usual by using getVariant
.
// In your feature.controller.js
req.unleash.getVariant('feature', ...);
You can also check alternatives or features that are enabled by using isEnabled
.
// In your controller
req.unleash.isEnabled('alternative');
Peek the persisted results:
req.unleash.results['feature']; // Variant object or null
Inspired by fflip-express
FAQs
express helper for unleash
The npm package unleash-express receives a total of 6 weekly downloads. As such, unleash-express popularity was classified as not popular.
We found that unleash-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.