{"library":"run-middleware","title":"run-middleware","description":"A Node.js module to programmatically execute Express middleware and route handlers without making network requests. It simulates a client calling REST APIs internally, allowing direct invocation of endpoints from code with support for custom query parameters, body, HTTP method, cookies, and response redirect tracking. Current stable version is 0.9.10 (last published in 2018). It has low maintenance activity, with no recent updates. Key differentiator: enables server-side execution of Express routes without requiring a listening server, useful for testing or reuse of logic.","language":"javascript","status":"maintenance","last_verified":"Sat Apr 25","install":{"commands":["npm install run-middleware"],"cli":null},"imports":["require('run-middleware')(app)","app.runMiddleware('/path', options, callback)","res.runMiddleware('/path', options, callback)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const express = require('express');\nconst app = express();\n\n// Define a route\napp.get('/api/hello', (req, res) => {\n  res.json({ message: 'Hello, world!' });\n});\n\n// Initialize run-middleware\nrequire('run-middleware')(app);\n\n// Invoke the route programmatically\napp.runMiddleware('/api/hello', (code, body, headers) => {\n  console.log('Status:', code);\n  console.log('Body:', body);\n});","lang":"javascript","description":"Demonstrates basic usage: setting up Express, requiring run-middleware to attach the method, then calling app.runMiddleware on a route to get the simulated response.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}