Registry / web-framework / connect-compose

connect-compose

JSON →
library0.0.1jsnpmunverified

connect-compose is a minimalist JavaScript utility designed to combine multiple `connect` middleware functions into a single, cohesive middleware. Published at version 0.0.1 nearly a decade ago, this package has seen no further development and is effectively abandoned. The underlying `connect` framework, while still functional, is also largely considered superseded by more comprehensive web frameworks like Express.js, which itself originated from `connect`. Developers seeking similar middleware composition functionality for modern Node.js applications, especially those using ESM, should look for actively maintained alternatives as `connect-compose` is not compatible with contemporary development practices and ecosystems.

npm install connect-compose
INSTALL
IMPORT
SIG · CONNECT-COMPOSE
C
connect-compose
web-frameworkjavascriptv0.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

compose
const compose = require('connect-compose')
import compose from 'connect-compose'
This package is CommonJS-only and does not support ES modules. Direct `import` statements will fail.

Demonstrates composing two simple middleware functions (`mw1`, `mw2`) into one using `connect-compose`, then applying it to a `connect` application alongside a final response-sending middleware.

const connect = require('connect'); const compose = require('connect-compose'); const http = require('http'); const app = connect(); // Middleware 1: Adds a property to the request object function mw1 (req, res, next) { req.stuff = ['mw1']; next(); } // Middleware 2: Modifies the property added by mw1 function mw2 (req, res, next) { req.stuff.push('mw2'); next(); } // Final middleware: Sends the aggregated 'stuff' as a response function mw3 (req, res) { res.end(req.stuff.join(', ')); } // Compose mw1 and mw2 into a single middleware and apply it app.use(compose([mw1, mw2])); // Apply the final middleware app.use(mw3); // Create an HTTP server and listen on port 6060 const server = http.createServer(app); server.listen(6060, () => { console.log('Connect app listening on http://localhost:6060'); console.log('Try visiting http://localhost:6060 in your browser.'); });
Debug
Known issues
breakingThis package is very old (last published ~10 years ago) and targets the connect@1.x/2.x era. It is not designed for modern Node.js versions or ES Modules.
fix
For new projects, consider alternatives like 'compose-middleware' or building on modern frameworks like Express.js directly, which includes similar functionality intrinsically. Ensure your project uses CommonJS and an older Node.js version if you must use this package.
affects: <=0.0.1
gotchaconnect-compose is CommonJS-only. Attempting to use `import` statements for this package in an ES Module context will result in a runtime error.
fix
Use `const compose = require('connect-compose');` for importing. If your project is ESM-first, you will need to wrap this in a CommonJS compatibility layer or use a different, ESM-compatible middleware composer.
affects: <=0.0.1
deprecatedThe underlying `connect` framework itself has not been actively developed since 2019 (version 3.7.0). Many applications have migrated to `Express.js` or other modern HTTP frameworks.
fix
Evaluate migrating to Express.js or a similar framework that offers built-in middleware handling and active community support. If using `connect`, be aware of the lack of recent updates and potential security concerns.
affects: <=0.0.1
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
connectrequiredconnect-compose is built specifically to compose middleware for the connect HTTP server framework.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
connect-compose — npm install connect-compose · libregistry