{"_id":"middie","_rev":"2506105","name":"middie","description":"Middleware engine for Fastify","dist-tags":{"latest":"6.0.0","stable-3":"3.2.1"},"maintainers":[{"name":"delvedor","email":""}],"time":{"modified":"2022-01-19T17:26:21.000Z","created":"2017-02-11T11:37:14.394Z","6.0.0":"2022-01-19T17:24:11.935Z","5.4.0":"2021-12-23T13:54:11.732Z","5.3.0":"2021-06-27T20:56:53.677Z","5.2.0":"2020-10-21T15:14:53.968Z","5.1.0":"2020-05-22T10:54:52.305Z","5.0.0":"2020-04-28T08:13:11.071Z","4.1.0":"2019-11-12T14:46:09.373Z","3.2.1":"2019-01-21T09:40:58.457Z","4.0.1":"2019-01-21T09:32:24.161Z","4.0.0":"2019-01-14T14:15:06.335Z","3.2.0":"2018-10-10T15:11:05.116Z","3.1.0":"2018-01-20T16:54:04.645Z","3.0.0":"2017-12-20T12:07:43.565Z","2.1.1":"2017-10-09T07:21:55.950Z","2.1.0":"2017-10-06T23:43:10.324Z","2.0.0":"2017-09-07T07:49:48.171Z","1.1.0":"2017-08-24T08:29:39.248Z","1.0.0":"2017-07-03T12:23:40.956Z","0.3.0":"2017-05-17T09:33:15.986Z","0.2.0":"2017-03-26T10:16:20.858Z","0.1.1":"2017-02-11T11:39:40.109Z","0.1.0":"2017-02-11T11:37:14.394Z"},"users":{"rsp":true},"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"versions":{"6.0.0":{"name":"middie","version":"6.0.0","description":"Middleware engine for Fastify","main":"index.js","types":"index.d.ts","scripts":{"coverage":"tap --cov --coverage-report=html test.js","test":"standard && tap --no-coverage test/*.test.js && tsd"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"@types/connect":"^3.4.33","@types/node":"^17.0.0","cors":"^2.8.5","fastify":"^3.0.0","helmet":"^5.0.0","pre-commit":"^1.2.2","serve-static":"^1.14.1","simple-get":"^4.0.0","standard":"^16.0.1","tap":"^15.0.1","tsd":"^0.19.0","typescript":"4.5.4"},"dependencies":{"fastify-plugin":"^3.0.0","path-to-regexp":"^6.1.0","reusify":"^1.0.4"},"engines":{"node":">=10.0.0"},"tsd":{"directory":"test"},"gitHead":"ffdc505a4fdd2230121433a4d7ce36c5196e77f0","_id":"middie@6.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"shasum":"050b07f3bf40ec5a7fd9136ab05a91213585b7a5","size":11130,"noattachment":false,"key":"/middie/-/middie-6.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-6.0.0.tgz"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"directories":{},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_6.0.0_1642613051791_0.46701966674793716"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-19T17:24:25.485Z","publish_time":1642613051935,"_cnpm_publish_time":1642613051935},"5.4.0":{"name":"middie","version":"5.4.0","description":"Middleware engine for Fastify","main":"index.js","types":"index.d.ts","scripts":{"coverage":"tap --cov --coverage-report=html test.js","test":"standard && tap --no-coverage test/*.test.js && tsd"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"@types/connect":"^3.4.33","@types/node":"^17.0.0","cors":"^2.8.5","fastify":"^3.0.0","helmet":"^4.0.0","pre-commit":"^1.2.2","serve-static":"^1.14.1","simple-get":"^4.0.0","standard":"^16.0.1","tap":"^15.0.1","tsd":"^0.19.0","typescript":"4.5.4"},"dependencies":{"fastify-plugin":"^3.0.0","path-to-regexp":"^6.1.0","reusify":"^1.0.4"},"engines":{"node":">=10.0.0"},"tsd":{"directory":"test"},"gitHead":"02db3932f8ea97aa4845ed61818d9e61cae428a4","_id":"middie@5.4.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"shasum":"caed02f948521ba968a4d4e845b7bd0949ae185d","size":10765,"noattachment":false,"key":"/middie/-/middie-5.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-5.4.0.tgz"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"directories":{},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_5.4.0_1640267651596_0.5308245861640144"},"_hasShrinkwrap":false,"publish_time":1640267651732,"_cnpm_publish_time":1640267651732},"5.3.0":{"name":"middie","version":"5.3.0","description":"Middleware engine for Fastify","main":"index.js","types":"index.d.ts","scripts":{"coverage":"tap --cov --coverage-report=html test.js","test":"standard && tap --no-coverage test/*.test.js && tsd"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"@types/connect":"^3.4.33","@types/node":"^15.0.0","cors":"^2.8.5","fastify":"^3.0.0","helmet":"^4.0.0","pre-commit":"^1.2.2","serve-static":"^1.14.1","simple-get":"^4.0.0","standard":"^16.0.1","tap":"^15.0.1","tsd":"^0.17.0","typescript":"4.3.4"},"dependencies":{"fastify-plugin":"^3.0.0","path-to-regexp":"^6.1.0","reusify":"^1.0.4"},"engines":{"node":">=10.0.0"},"tsd":{"directory":"test"},"gitHead":"74226d67bacc7daf4057dea6f734bb4e497a5dfa","_id":"middie@5.3.0","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"shasum":"6c871b3efecdb65f86c67a7787336d39b03d626d","size":10617,"noattachment":false,"key":"/middie/-/middie-5.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-5.3.0.tgz"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"directories":{},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_5.3.0_1624827413539_0.7245692207336916"},"_hasShrinkwrap":false,"publish_time":1624827413677,"_cnpm_publish_time":1624827413677},"5.2.0":{"name":"middie","version":"5.2.0","description":"Middleware engine for Fastify","main":"index.js","types":"index.d.ts","scripts":{"test":"standard && tap --no-coverage test/*.test.js && tsd","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"@types/connect":"^3.4.33","@types/node":"^14.0.20","cors":"^2.8.5","fastify":"^3.0.0","helmet":"^4.0.0","pre-commit":"^1.2.2","serve-static":"^1.14.1","simple-get":"^4.0.0","standard":"^14.3.1","tap":"^14.10.5","tsd":"^0.13.1","typescript":"4.0.3"},"dependencies":{"fastify-plugin":"^3.0.0","path-to-regexp":"^6.1.0","reusify":"^1.0.4"},"engines":{"node":">=10.0.0"},"tsd":{"directory":"test"},"gitHead":"92152b38a5c1efd847053671ada93dd715032792","_id":"middie@5.2.0","_nodeVersion":"12.19.0","_npmVersion":"6.14.8","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"0d8a4835c0d08a0a0c611a932e755b7376f60c61","size":10513,"noattachment":false,"key":"/middie/-/middie-5.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-5.2.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_5.2.0_1603293293843_0.4392165969171138"},"_hasShrinkwrap":false,"publish_time":1603293293968,"_cnpm_publish_time":1603293293968},"5.1.0":{"name":"middie","version":"5.1.0","description":"Middleware engine for Fastify","main":"index.js","types":"index.d.ts","scripts":{"test":"standard && tap --no-coverage test/*.test.js && tsd","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.5","fastify":"^3.0.0-rc.3","helmet":"^3.21.2","pre-commit":"^1.2.2","serve-static":"^1.14.1","simple-get":"^4.0.0","standard":"^14.3.1","tap":"^14.10.5","tsd":"^0.11.0","typescript":"3.9.3"},"dependencies":{"fastify-plugin":"^2.0.0","path-to-regexp":"^6.1.0","reusify":"^1.0.4"},"engines":{"node":">=10.0.0"},"tsd":{"directory":"test"},"gitHead":"476d2d9d6e2c9b4e9dc3d54853ab0ed6b2791c50","_id":"middie@5.1.0","_nodeVersion":"12.16.3","_npmVersion":"6.14.5","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"c7b132c8569bc0cedac7dbb52a8a4338aef20fe2","size":9978,"noattachment":false,"key":"/middie/-/middie-5.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-5.1.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_5.1.0_1590144892185_0.9976604020801831"},"_hasShrinkwrap":false,"publish_time":1590144892305,"_cnpm_publish_time":1590144892305},"5.0.0":{"name":"middie","version":"5.0.0","description":"Middleware engine for Fastify","main":"index.js","scripts":{"test":"standard && tap --no-coverage test/*.test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.5","fastify":"^3.0.0-alpha.1","helmet":"^3.21.2","pre-commit":"^1.2.2","serve-static":"^1.14.1","simple-get":"^3.1.0","standard":"^14.3.1","tap":"^14.10.5"},"dependencies":{"fastify-plugin":"^2.0.0","path-to-regexp":"^6.1.0","reusify":"^1.0.4"},"engines":{"node":">=10.0.0"},"gitHead":"82988a4e42673e8ee83ad939ed7a3701c143a38b","_id":"middie@5.0.0","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"shasum":"6c0658c665b9eaf9fa2510351c3a2df1d92b7267","size":9745,"noattachment":false,"key":"/middie/-/middie-5.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-5.0.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmUser":{"name":"delvedor","email":"tommydelved@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_5.0.0_1588061590906_0.23163648385500912"},"_hasShrinkwrap":false,"publish_time":1588061591071,"_cnpm_publish_time":1588061591071},"4.1.0":{"name":"middie","version":"4.1.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^14.0.2","tap":"^12.6.5"},"dependencies":{"path-to-regexp":"^4.0.0","reusify":"^1.0.2"},"greenkeeper":{"ignore":["tap"]},"gitHead":"b23f0bc125ad8ad499c572a7e86d3ae6c993d65f","_id":"middie@4.1.0","_nodeVersion":"12.13.0","_npmVersion":"6.13.0","dist":{"shasum":"0fe986c83d5081489514ca1a2daba5ca36263436","size":4806,"noattachment":false,"key":"/middie/-/middie-4.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-4.1.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_4.1.0_1573569969177_0.4475525337022821"},"_hasShrinkwrap":false,"publish_time":1573569969373,"_cnpm_publish_time":1573569969373},"3.2.1":{"name":"middie","version":"3.2.1","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^12.0.0","tap":"^12.0.0"},"dependencies":{"path-to-regexp":"^2.0.0","reusify":"^1.0.2"},"readmeFilename":"README.md","gitHead":"206483049bad3b27521e8e704fd1e7fbe9e4c367","_id":"middie@3.2.1","_nodeVersion":"10.14.2","_npmVersion":"6.6.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"90fde2e6bbcbc2c0b61082a09a7623aaa40cf1ff","size":4745,"noattachment":false,"key":"/middie/-/middie-3.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-3.2.1.tgz"},"maintainers":[{"name":"delvedor","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_3.2.1_1548063658289_0.8134544952148859"},"_hasShrinkwrap":false,"publish_time":1548063658457,"_cnpm_publish_time":1548063658457},"4.0.1":{"name":"middie","version":"4.0.1","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^12.0.0","tap":"^12.0.0"},"dependencies":{"path-to-regexp":"^3.0.0","reusify":"^1.0.2"},"gitHead":"684618452516db75089a17c51ef68d2e20b9efc8","_id":"middie@4.0.1","_nodeVersion":"10.14.2","_npmVersion":"6.6.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"24b4333034926ebd7831ed58766d050c1ce6300a","size":4751,"noattachment":false,"key":"/middie/-/middie-4.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-4.0.1.tgz"},"maintainers":[{"name":"delvedor","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_4.0.1_1548063143994_0.839340323860563"},"_hasShrinkwrap":false,"publish_time":1548063144161,"_cnpm_publish_time":1548063144161},"4.0.0":{"name":"middie","version":"4.0.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^12.0.0","tap":"^12.0.0"},"dependencies":{"path-to-regexp":"^3.0.0","reusify":"^1.0.2"},"gitHead":"4def9ce536d9d05acf777847defd38a7258d7905","_id":"middie@4.0.0","_nodeVersion":"10.14.2","_npmVersion":"6.6.0-next.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"5acc37fd4dc1bf1ac93daa391c4a6cca965927cb","size":4630,"noattachment":false,"key":"/middie/-/middie-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-4.0.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_4.0.0_1547475306216_0.6577396821299395"},"_hasShrinkwrap":false,"publish_time":1547475306335,"_cnpm_publish_time":1547475306335},"3.2.0":{"name":"middie","version":"3.2.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^12.0.0","tap":"^12.0.0"},"dependencies":{"path-to-regexp":"^2.0.0","reusify":"^1.0.2"},"gitHead":"3d41b4e50baabba1ba5ab2fe6382bee1efeb6a97","_id":"middie@3.2.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"d7cf1deb78b4dd84ab5408c68271406b381bf339","size":4624,"noattachment":false,"key":"/middie/-/middie-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-3.2.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie_3.2.0_1539184265009_0.9606203021801856"},"_hasShrinkwrap":false,"publish_time":1539184265116,"_cnpm_publish_time":1539184265116},"3.1.0":{"name":"middie","version":"3.1.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.4","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.1.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^10.0.3","tap":"^11.0.0","x-xss-protection":"^1.0.0"},"dependencies":{"path-to-regexp":"^2.0.0","reusify":"^1.0.2"},"gitHead":"03a25797e39bfd134dbfb75025139d7747cd2d76","_id":"middie@3.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"delvedor","email":"tommydelved@gmail.com"},"dist":{"shasum":"99986a166e827fd0b0c8fa55f5ee28e7b6c23d9f","size":4599,"noattachment":false,"key":"/middie/-/middie-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-3.1.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie-3.1.0.tgz_1516467243670_0.1690646349452436"},"directories":{},"publish_time":1516467244645,"_hasShrinkwrap":false,"_cnpm_publish_time":1516467244645},"3.0.0":{"name":"middie","version":"3.0.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.4","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.1.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^10.0.3","tap":"^11.0.0","x-xss-protection":"^1.0.0"},"dependencies":{"path-to-regexp":"^2.0.0","reusify":"^1.0.2"},"gitHead":"a3ba62d010750eaea32542fb61c2f94ca552fec8","_id":"middie@3.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.2","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"7e8aa71b98bcb6c42f89d369044502dbb2d69c93","size":4476,"noattachment":false,"key":"/middie/-/middie-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-3.0.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie-3.0.0.tgz_1513771662615_0.6629042385611683"},"directories":{},"publish_time":1513771663565,"_hasShrinkwrap":false,"_cnpm_publish_time":1513771663565},"2.1.1":{"name":"middie","version":"2.1.1","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.4","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.1.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^10.0.3","tap":"^10.7.2","x-xss-protection":"^1.0.0"},"dependencies":{"path-to-regexp":"^2.0.0","reusify":"^1.0.2"},"gitHead":"2ac769a0a64e396de5d2d08990e82863a154f3cd","_id":"middie@2.1.1","_npmVersion":"5.4.2","_nodeVersion":"8.6.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"4b79c0fe78b243c4e98ae59065426b8aa8ede588","size":4426,"noattachment":false,"key":"/middie/-/middie-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-2.1.1.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie-2.1.1.tgz_1507533715041_0.17573508201166987"},"directories":{},"publish_time":1507533715950,"_hasShrinkwrap":false,"_cnpm_publish_time":1507533715950},"2.1.0":{"name":"middie","version":"2.1.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.4","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.1.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^10.0.3","tap":"^10.7.2","x-xss-protection":"^1.0.0"},"dependencies":{"path-to-regexp":"^2.0.0","reusify":"^1.0.2"},"gitHead":"18d9974b85fbfa50247230f47ffe8d2c6d582f31","_id":"middie@2.1.0","_npmVersion":"5.4.2","_nodeVersion":"8.6.0","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"5768c0503c7f160d7d8f7bf4724f073bb32e7493","size":4382,"noattachment":false,"key":"/middie/-/middie-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-2.1.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie-2.1.0.tgz_1507333390251_0.5918108546175063"},"directories":{},"publish_time":1507333390324,"_cnpm_publish_time":1507333390324,"_hasShrinkwrap":false},"2.0.0":{"name":"middie","version":"2.0.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.4","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.1.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","serve-static":"^1.12.4","standard":"^10.0.3","tap":"^10.7.2","x-xss-protection":"^1.0.0"},"dependencies":{"path-to-regexp":"^2.0.0","reusify":"^1.0.2"},"gitHead":"62ceb377936546e8d3a006b9f495e1c5f5902c96","_id":"middie@2.0.0","_shasum":"e41a31f48fe66e1052f85331d4474861ed3104ab","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"e41a31f48fe66e1052f85331d4474861ed3104ab","size":4474,"noattachment":false,"key":"/middie/-/middie-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-2.0.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie-2.0.0.tgz_1504770587221_0.04371211607940495"},"directories":{},"publish_time":1504770588171,"_hasShrinkwrap":false,"_cnpm_publish_time":1504770588171},"1.1.0":{"name":"middie","version":"1.1.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.4","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.1.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","standard":"^10.0.3","tap":"^10.7.2","x-xss-protection":"^1.0.0"},"dependencies":{"reusify":"^1.0.2"},"gitHead":"a9737975a45858f46698cb4a912b15db39bd8c5e","_id":"middie@1.1.0","_shasum":"6d77100e816310d15688245b8eb775782783472e","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"delvedor","email":"tommydelved@gmail.com"},"dist":{"shasum":"6d77100e816310d15688245b8eb775782783472e","size":4177,"noattachment":false,"key":"/middie/-/middie-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-1.1.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie-1.1.0.tgz_1503563378343_0.6475021056830883"},"directories":{},"publish_time":1503563379248,"_hasShrinkwrap":false,"_cnpm_publish_time":1503563379248},"1.0.0":{"name":"middie","version":"1.0.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.1","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.0.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","standard":"^10.0.0","tap":"^10.1.0","x-xss-protection":"^1.0.0"},"dependencies":{"reusify":"^1.0.1"},"gitHead":"ae539cbe8d3403b19e44f2e4cb0061566e5aca43","_id":"middie@1.0.0","_shasum":"556d9f570bd02aadd444d89951768258de2bb3cf","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"delvedor","email":"tommydelved@gmail.com"},"dist":{"shasum":"556d9f570bd02aadd444d89951768258de2bb3cf","size":3974,"noattachment":false,"key":"/middie/-/middie-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-1.0.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middie-1.0.0.tgz_1499084620010_0.2863162874709815"},"directories":{},"publish_time":1499084620956,"_hasShrinkwrap":false,"_cnpm_publish_time":1499084620956},"0.3.0":{"name":"middie","version":"0.3.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.1","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.0.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","standard":"^10.0.0","tap":"^10.1.0","x-xss-protection":"^1.0.0"},"dependencies":{"pathname-match":"^1.2.0","reusify":"^1.0.1"},"gitHead":"094b1e6a587532379e536feea2830f3ee83e993e","_id":"middie@0.3.0","_shasum":"1a1ff9372c3c7780aae9dad58a7f70de7321a958","_from":".","_npmVersion":"4.5.0","_nodeVersion":"6.10.1","_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"dist":{"shasum":"1a1ff9372c3c7780aae9dad58a7f70de7321a958","size":3888,"noattachment":false,"key":"/middie/-/middie-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-0.3.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/middie-0.3.0.tgz_1495013594268_0.4759539901278913"},"directories":{},"publish_time":1495013595986,"_cnpm_publish_time":1495013595986,"_hasShrinkwrap":false},"0.2.0":{"name":"middie","version":"0.2.0","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.1","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.0.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","standard":"^8.6.0","tap":"^10.1.0","x-xss-protection":"^1.0.0"},"dependencies":{"pathname-match":"^1.2.0","reusify":"^1.0.1"},"gitHead":"6d8a3312eed7c09a1f9a4adcd3de8f8e626932a1","_id":"middie@0.2.0","_shasum":"2f644bb79ab1ca4f2b25265157a8e6784e58d357","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"delvedor","email":"tommydelved@gmail.com"},"dist":{"shasum":"2f644bb79ab1ca4f2b25265157a8e6784e58d357","size":3653,"noattachment":false,"key":"/middie/-/middie-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-0.2.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/middie-0.2.0.tgz_1490523379094_0.241825902601704"},"directories":{},"publish_time":1490523380858,"_hasShrinkwrap":false,"_cnpm_publish_time":1490523380858},"0.1.1":{"name":"middie","version":"0.1.1","description":"Middleware engine for Fastify","main":"middie.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.1","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.0.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","standard":"^8.6.0","tap":"^10.1.0","x-xss-protection":"^1.0.0"},"dependencies":{"reusify":"^1.0.1"},"gitHead":"5ddd7b47ac442b8356640a699324203cf2295872","_id":"middie@0.1.1","_shasum":"e6912e0ee95e5651c7a067a4d037d0b1f67af4cb","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"delvedor","email":"tommydelved@gmail.com"},"dist":{"shasum":"e6912e0ee95e5651c7a067a4d037d0b1f67af4cb","size":3109,"noattachment":false,"key":"/middie/-/middie-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-0.1.1.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/middie-0.1.1.tgz_1486813179196_0.9840279896743596"},"directories":{},"publish_time":1486813180109,"_cnpm_publish_time":1486813180109,"_hasShrinkwrap":false},"0.1.0":{"name":"middie","version":"0.1.0","description":"Middleware engine for Fastify","main":"middleman.js","scripts":{"test":"standard && tap test.js","coverage":"tap --cov --coverage-report=html test.js"},"keywords":["fastify","middleware","webframework","performances"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"contributors":[{"name":"Tomas Della Vedova","url":"http://delved.org"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fastify/middleman.git"},"bugs":{"url":"https://github.com/fastify/middleman/issues"},"homepage":"https://github.com/fastify/middleman#readme","devDependencies":{"cors":"^2.8.1","dns-prefetch-control":"^0.1.0","frameguard":"^3.0.0","hide-powered-by":"^1.0.0","hsts":"^2.0.0","ienoopen":"^1.0.0","pre-commit":"^1.2.2","standard":"^8.6.0","tap":"^10.1.0","x-xss-protection":"^1.0.0"},"dependencies":{"reusify":"^1.0.1"},"gitHead":"d3ef38b4f9d493095e48b698831cd760c566539c","_id":"middie@0.1.0","_shasum":"a77f9f727014c81cc097cef11e047a260f7790b0","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.4","_npmUser":{"name":"delvedor","email":"tommydelved@gmail.com"},"dist":{"shasum":"a77f9f727014c81cc097cef11e047a260f7790b0","size":3111,"noattachment":false,"key":"/middie/-/middie-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/middie/download/middie-0.1.0.tgz"},"maintainers":[{"name":"delvedor","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/middie-0.1.0.tgz_1486813033771_0.4615455321036279"},"directories":{},"publish_time":1486813034394,"_cnpm_publish_time":1486813034394,"_hasShrinkwrap":false}},"readme":"# middie\n\n![CI](https://github.com/fastify/middie/workflows/CI/badge.svg)\n[![NPM version](https://img.shields.io/npm/v/middie.svg?style=flat)](https://www.npmjs.com/package/middie)\n[![Known Vulnerabilities](https://snyk.io/test/github/fastify/middie/badge.svg)](https://snyk.io/test/github/fastify/middie)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)\n\n*middie* is the plugin that adds middleware support on steroids to [Fastify](https://www.npmjs.com/package/fastify).\n\nThe syntax style is the same as [express](http://npm.im/express)/[connect](https://www.npmjs.com/package/connect).\nDoes not support the full syntax `middleware(err, req, res, next)`, because error handling is done inside Fastify.\n\n## Install\n\n```\nnpm install middie\n```\n\n## Usage\nRegister the plugin and start using your middleware.\n```js\nconst Fastify = require('fastify')\n\nasync function build () {\n  const fastify = Fastify()\n  await fastify.register(require('middie'), {\n    hook: 'onRequest' // default\n  })\n  // do you know we also have cors support?\n  // https://github.com/fastify/fastify-cors\n  fastify.use(require('cors')())\n  return fastify\n}\n\nbuild()\n  .then(fastify => fastify.listen(3000))\n  .catch(console.log)\n```\n\n### Encapsulation support\n\nThe encapsulation works as usual with Fastify, you can register the plugin in a subsystem and your code will work only inside there, or you can declare the middie plugin top level and register a middleware in a nested plugin, and the middleware will be executed only for the nested routes of the specific plugin.\n\n*Register the plugin in its own subsystem:*\n```js\nconst fastify = require('fastify')()\n\nfastify.register(subsystem)\n\nasync function subsystem (fastify, opts) {\n  await fastify.register(require('middie'))\n  fastify.use(require('cors')())\n}\n```\n\n*Register a middleware in a specific plugin:*\n```js\nconst fastify = require('fastify')()\n\nfastify\n  .register(require('middie'))\n  .register(subsystem)\n\nasync function subsystem (fastify, opts) {\n  fastify.use(require('cors')())\n}\n```\n\n### Hooks and middleware\n\n__Every registered middleware will be run during the `onRequest` hook phase__, so the registration order is important.\nTake a look at the [Lifecycle](https://www.fastify.io/docs/latest/Lifecycle/) documentation page to understand better how every request is executed.\n\n```js\nconst fastify = require('fastify')()\n\nfastify\n  .register(require('middie'))\n  .register(subsystem)\n\nasync function subsystem (fastify, opts) {\n  fastify.addHook('onRequest', async (req, reply) => {\n    console.log('first')\n  })\n\n  fastify.use((req, res, next) => {\n    console.log('second')\n    next()\n  })\n\n  fastify.addHook('onRequest', async (req, reply) => {\n    console.log('third')\n  })\n}\n```\n\nIf you want to change the Fastify hook that the middleware will be attached to, pass a `hook` option like so:\n\n```js\nconst fastify = require('fastify')()\n\nfastify\n  .register(require('middie'), { hook: 'preHandler' })\n  .register(subsystem)\n\nasync function subsystem (fastify, opts) {\n  fastify.addHook('onRequest', async (req, reply) => {\n    console.log('first')\n  })\n\n  fastify.use((req, res, next) => {\n    console.log('third')\n    next()\n  })\n\n  fastify.addHook('onRequest', async (req, reply) => {\n    console.log('second')\n  })\n\n  fastify.addHook('preHandler', async (req, reply) => {\n    console.log('fourth')\n  })\n}\n```\n\n### Restrict middleware execution to a certain path(s)\n\nIf you need to run a middleware only under certain path(s), just pass the path as first parameter to use and you are done!\n\n```js\nconst fastify = require('fastify')()\nconst path = require('path')\nconst serveStatic = require('serve-static')\n\nfastify\n  .register(require('middie'))\n  .register(subsystem)\n\nasync function subsystem (fastify, opts) {\n  // Single path\n  fastify.use('/css', serveStatic(path.join(__dirname, '/assets')))\n\n  // Wildcard path\n  fastify.use('/css/*', serveStatic(path.join(__dirname, '/assets')))\n\n  // Multiple paths\n  fastify.use(['/css', '/js'], serveStatic(path.join(__dirname, '/assets')))\n}\n```\n\n# Middie Engine\n\nYou can also use the engine itself without the Fastify plugin system.\n\n## Usage\n```js\nconst Middie = require('middie/engine')\nconst http = require('http')\nconst helmet = require('helmet')\nconst cors = require('cors')\n\nconst middie = Middie(_runMiddlewares)\nmiddie.use(helmet())\nmiddie.use(cors())\n\nhttp\n  .createServer(function handler (req, res) {\n    middie.run(req, res)\n  })\n  .listen(3000)\n\nfunction _runMiddlewares (err, req, res) {\n  if (err) {\n    console.log(err)\n    res.end(err)\n    return\n  }\n\n  // => routing function\n}\n```\n<a name=\"keep-context\"></a>\n#### Keep the context\nIf you need it you can also keep the context of the calling function by calling `run` with `run(req, res, this)`, in this way you can avoid closures allocation.\n\n```js\nhttp\n  .createServer(function handler (req, res) {\n    middie.run(req, res, { context: 'object' })\n  })\n  .listen(3000)\n\nfunction _runMiddlewares (err, req, res, ctx) {\n  if (err) {\n    console.log(err)\n    res.end(err)\n    return\n  }\n  console.log(ctx)\n}\n```\n\n<a name=\"restrict-usage\"></a>\n#### Restrict middleware execution to a certain path(s)\nIf you need to run a middleware only under certains path(s), just pass the path as first parameter to `use` and you are done!\n\n*Note that this does support routes with parameters, e.g. `/user/:id/comments`, but all the matched parameters will be discarded*\n\n```js\n// Single path\nmiddie.use('/public', staticFiles('/assets'))\n\n// Multiple middleware\nmiddie.use('/public', [cors(), staticFiles('/assets')])\n\n// Multiple paths\nmiddie.use(['/public', '/dist'], staticFiles('/assets'))\n\n// Multiple paths and multiple middleware\nmiddie.use(['/public', '/dist'], [cors(), staticFiles('/assets')])\n```\n\nTo guarantee compatibility with Express, adding a prefix uses [`path-to-regexp`](https://www.npmjs.com/package/path-to-regexp) to compute\na `RegExp`, which is then used to math every request: it is significantly slower.\n\n## TypeScript support\n\nTo use this module with TypeScript, make sure to install `@types/connect`.\n\n## Middleware alternatives\n\nFastify offers some alternatives to the most commonly used Express middleware:\n\n| Express Middleware | Fastify Plugin |\n| ------------- |---------------|\n| [`helmet`](https://github.com/helmetjs/helmet) | [`fastify-helmet`](https://github.com/fastify/fastify-helmet) |\n| [`cors`](https://github.com/expressjs/cors) | [`fastify-cors`](https://github.com/fastify/fastify-cors) |\n| [`serve-static`](https://github.com/expressjs/serve-static) | [`fastify-static`](https://github.com/fastify/fastify-static) |\n\n## Acknowledgements\n\nThis project is kindly sponsored by:\n- [nearForm](https://nearform.com)\n\nPast sponsors:\n- [LetzDoIt](https://www.letzdoitapp.com/)\n\n## License\n\nLicensed under [MIT](./LICENSE).\n","_attachments":{},"homepage":"https://github.com/fastify/middleman#readme","bugs":{"url":"https://github.com/fastify/middleman/issues"},"license":"MIT"}