{"id":17543,"library":"connect-compose","title":"Compose Connect Middleware","description":"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.","status":"abandoned","version":"0.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/vkurchatkin/connect-compose","tags":["javascript","connect","middleware","compose"],"install":[{"cmd":"npm install connect-compose","lang":"bash","label":"npm"},{"cmd":"yarn add connect-compose","lang":"bash","label":"yarn"},{"cmd":"pnpm add connect-compose","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"connect-compose is built specifically to compose middleware for the connect HTTP server framework.","package":"connect","optional":false}],"imports":[{"note":"This package is CommonJS-only and does not support ES modules. Direct `import` statements will fail.","wrong":"import compose from 'connect-compose'","symbol":"compose","correct":"const compose = require('connect-compose')"}],"quickstart":{"code":"const connect = require('connect');\nconst compose = require('connect-compose');\nconst http = require('http');\n\nconst app = connect();\n\n// Middleware 1: Adds a property to the request object\nfunction mw1 (req, res, next) {\n  req.stuff = ['mw1'];\n  next();\n}\n\n// Middleware 2: Modifies the property added by mw1\nfunction mw2 (req, res, next) {\n  req.stuff.push('mw2');\n  next();\n}\n\n// Final middleware: Sends the aggregated 'stuff' as a response\nfunction mw3 (req, res) {\n  res.end(req.stuff.join(', '));\n}\n\n// Compose mw1 and mw2 into a single middleware and apply it\napp.use(compose([mw1, mw2]));\n\n// Apply the final middleware\napp.use(mw3);\n\n// Create an HTTP server and listen on port 6060\nconst server = http.createServer(app);\nserver.listen(6060, () => {\n  console.log('Connect app listening on http://localhost:6060');\n  console.log('Try visiting http://localhost:6060 in your browser.');\n});\n","lang":"javascript","description":"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."},"warnings":[{"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.","message":"This 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.","severity":"breaking","affected_versions":"<=0.0.1"},{"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.","message":"connect-compose is CommonJS-only. Attempting to use `import` statements for this package in an ES Module context will result in a runtime error.","severity":"gotcha","affected_versions":"<=0.0.1"},{"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.","message":"The 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.","severity":"deprecated","affected_versions":"<=0.0.1"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}