{"name":"bundles","version":"1.0.0","description":"Flexible standalone middleware stacker with hooks","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha test/"},"repository":{"type":"git","url":"https://github.com/scottcorgan/bundles.git"},"keywords":["connect","express","stack","bundle"],"author":{"name":"Scott Corgan"},"license":"MIT","bugs":{"url":"https://github.com/scottcorgan/bundles/issues"},"homepage":"https://github.com/scottcorgan/bundles","devDependencies":{"chai":"^1.9.1","connect":"^3.2.0","mocha":"^1.21.4","supertest":"^0.13.0"},"dependencies":{"async":"^0.9.0"},"gitHead":"06f1758e9124eb8b6ea68c7e7f4343ffa7008cc9","_id":"bundles@1.0.0","_shasum":"fd932a9d1442dc04db8668e93dbd2044023ffa15","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"scottcorgan","email":"scottcorgan@gmail.com"},"maintainers":[{"name":"scottcorgan","email":"scottcorgan@gmail.com"}],"dist":{"shasum":"fd932a9d1442dc04db8668e93dbd2044023ffa15","tarball":"http://registry-npm.ywwl.com/bundles/download/bundles-1.0.0.tgz","integrity":"sha512-v3YjbhX1bz5e8AfHyrAvcyje4eKFlS7R626frEXT2yl+K0Dmcxfp5OkPj+VN43X8zQ0aA6HQl9232tOMLesIBg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQnm1pEsMJgf09bLXwZ0on8fQEnmhP7d7IdLbF3rpfuAIhAJvyy/qxZ8sqRL5eWA4PS/3VJ11KUt2RDhvWbPvkE3pA"}],"size":3056,"noattachment":false,"key":"/bundles/-/bundles-1.0.0.tgz"},"readme":"# bundles\n\nFlexible standalone middleware stacker with hooks. This is useful for bundling together functionality as one standalone middleware for use with other modules like [Connect](https://www.npmjs.org/package/connect) or [Express](https://www.npmjs.org/package/express).\n\n## Install\n\n```\nnpm install bundles --save\n```\n\n## Usage\n\nBasic\n\n```js\nvar bundles = require('bundles');\nvar connect = require('connect');\n\nvar bundle = bundles();\n\nbundle.use(function (req, res, next) {\n  // do something\n  next();\n});\n\napp.use(bundle);\n\napp.listen(3000, function () {\n  \n});\n```\n\nHooks and named middleware\n\n```js\nvar bundles = require('bundles');\nvar connect = require('connect');\n\nvar bundle = bundles();\n\nbundle.use('bundle1', function (req, res, next) {\n  // do something\n  next();\n});\n\nbundle.useBefore('bundle1', function (req, res, next) {\n  // executes before bundle1\n  next();\n});\n\nbundle.useAfter('bundle1', function (req, res, next) {\n  // executes after bundle1\n  next();\n});\n\napp.use(bundle);\n\napp.listen(3000, function () {\n  \n});\n```\n\n## API\n\n### bundle.use([name, ] callback)\n\nDeclare middleware in the bundle.\n\n* `name` - OPTIONAL - name of the middleware. Useful for hook into middleware chain\n* `callback` - typical middleware callback to that takes 3 arguments: `req`, `res`, `next`\n\n### bundle.useBefore(name, callback)\n\nHook a middleware before the named middleware\n\n* `name` - the name of the middleware to hook before\n* `callback` - typical middleware callback to that takes 3 arguments: `req`, `res`, `next`\n\n### bundle.useAfter(name, callback)\n\nHook a middleware after the named middleware\n\n* `name` - the name of the middleware to hook after\n* `callback` - typical middleware callback to that takes 3 arguments: `req`, `res`, `next`\n\n## Run Tests\n\n```\nnpm install\nnpm test\n```","publish_time":1411520650391,"_cnpm_publish_time":1411520650391,"dist-tags":{"latest":"2.0.0"}}