{"_id":"zen","_rev":"18-caf238092846fcc689e9ea30ab6aaa67","name":"zen","description":"is a simple, safe, basic, fast, general purpose module engine","dist-tags":{"latest":"0.1.7"},"versions":{"0.1.1":{"name":"zen","version":"0.1.1","description":"is a simple, basic, fast, general purpose module engine","keywords":["engine","stack","module","wsgi","rack","next"],"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"dependencies":{},"main":"zen.js","engines":{"node":">= 0.4.0 < 0.5.0"},"_id":"zen@0.1.1","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.10","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"689d0106f5282b70022c062b388ae340dec45998","tarball":"https://registry.npmjs.org/zen/-/zen-0.1.1.tgz","integrity":"sha512-eOUF42WduPa4/EcvmSI0O5eBw6sn6qUTVP9XSO6lf4F1jg+F2bg2DJUPLVq2/sxw90z+eXJYuugS8MbrdG/rtg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAyd4Lpp8v4Sk7xkocHy+/ZKAdcUxcf/Ua7Cr+KRy7BAIhAO9NQJ63hWq2WhkI2xmoBXd6uwXF27+LRNPk5KvrDFUm"}]},"scripts":{},"directories":{}},"0.1.2":{"name":"zen","version":"0.1.2","description":"is a simple, safe, basic, fast, general purpose module engine","keywords":["engine","stack","module","wsgi","rack","next"],"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"dependencies":{},"main":"zen.js","engines":{"node":">= 0.4.0 < 0.5.0"},"_id":"zen@0.1.2","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.10","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"270bc1d9b5e799897c9c9bf73df435b583b91764","tarball":"https://registry.npmjs.org/zen/-/zen-0.1.2.tgz","integrity":"sha512-Ngxhl8cRXNK/DPAk5W8zYEwUcDX7j43ayNN3MY2CfwKd1V5V/9rfIQdSIvS5UTvjS2cJpOM7zlE+VvO1jyY3nQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6k/AUZb30L0ABY5Vw0wxb1oaS123upLb4ss8A6+GKQgIhANDrclbUiSbfJRSxjys0mKcEiU2M5vTdQVuSbdzd0HuP"}]},"scripts":{},"directories":{}},"0.1.3":{"name":"zen","version":"0.1.3","description":"is a simple, safe, basic, fast, general purpose module engine","keywords":["engine","stack","module","wsgi","rack","next"],"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"dependencies":{},"devDependencies":{"nodeunit":"*","benchmark":"0.2.1"},"main":"zen.js","engines":{"node":">= 0.4.0 < 0.5.0"},"_id":"zen@0.1.3","_engineSupported":true,"_npmVersion":"1.0.10","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"10f7a50c0cdb6b68509fc21b212c438bcfcf8767","tarball":"https://registry.npmjs.org/zen/-/zen-0.1.3.tgz","integrity":"sha512-0ZSDtNuw6Z52/1BAeWRUOIn+leT5slHuHBe4QzO3xEvNHWnhi+Dwctochx7jt9KjR+DVOa2yaA/sXPPtwSG87Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0nmnK067r7kiu7q5Q/s0yuaG19gDG0v3jgtyd+ceLcgIgJJ093Se4ka7/diUfQrlGK/RS8Pp0hPJn8Y8Q+I4oICk="}]},"scripts":{},"directories":{}},"0.1.4":{"name":"zen","version":"0.1.4","description":"is a simple, safe, basic, fast, general purpose module engine","keywords":["engine","stack","module","wsgi","rack","next"],"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"dependencies":{},"devDependencies":{"nodeunit":"*","benchmark":"0.2.1"},"main":"zen.js","engines":{"node":">= 0.4.0 < 0.7.0"},"_npmUser":{"name":"pblabs","email":"labs@pianobit.com"},"_id":"zen@0.1.4","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"514e811433c2c24ddbf720eeac4ea6200b48f385","tarball":"https://registry.npmjs.org/zen/-/zen-0.1.4.tgz","integrity":"sha512-9NrBrQegaWJ2jwJrDtk06KEX3uRZPq2kwsenQLu1Uc/CCZnxQz5I+xB5GFB2AxHTeitTsBQpD7T8d2NulLmzKQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF2TE6IyvzKioGMwwrmO0SL8BNLKZ+381fURyJcWILT4AiEA5bWpHFSt4tAruLffi8AmYndRzGqTg9tKKSCVexl8OHc="}]},"maintainers":[{"name":"pblabs","email":"labs@pianobit.com"}],"directories":{}},"0.1.5":{"name":"zen","version":"0.1.5","description":"is a simple, safe, basic, fast, general purpose modules engine","keywords":["engine","stack","module","wsgi","rack","next"],"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"dependencies":{},"devDependencies":{"nodeunit":"*","benchmark":"0.2.1"},"main":"zen.js","engines":{"node":">= 0.4.0 < 0.11.0"},"bugs":{"url":"https://github.com/pblabs/zen/issues"},"_id":"zen@0.1.5","dist":{"shasum":"0b9c7b3e3a238638417f1724d6ead9f17e2125e8","tarball":"https://registry.npmjs.org/zen/-/zen-0.1.5.tgz","integrity":"sha512-qkVvvm4IEQKtVUeeHuGRz1VGKuxsMeTHn9RikYa6EKz8e462zKCxrI7RHKFbTHrb5QfnF36S3gAFVUxuqYi61A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICNp9KWgqZkhatBm88BRuK7XFOFBtnHyWEqz1LWc/X8NAiEAs+1E1grzPUr8ENBfXJuhDbxp8s+N7a7KAzvpiebZZ4o="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"pblabs","email":"labs@pianobit.com"},"maintainers":[{"name":"pblabs","email":"labs@pianobit.com"}],"directories":{}},"0.1.6":{"name":"zen","version":"0.1.6","description":"is a simple, safe, basic, fast, general purpose module engine","keywords":["engine","stack","module","wsgi","rack","next"],"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"dependencies":{},"devDependencies":{"nodeunit":"*","benchmark":"0.2.1"},"main":"zen.js","engines":{"node":">= 0.4.0 < 0.11.0"},"gitHead":"41d216f8272aae662e19e5d8508e0dc52cce88f7","bugs":{"url":"https://github.com/pblabs/zen/issues"},"homepage":"https://github.com/pblabs/zen","_id":"zen@0.1.6","scripts":{},"_shasum":"a5dc82a2364d49a68c5191a914005e8d04a08407","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"pblabs","email":"labs@pianobit.com"},"maintainers":[{"name":"pblabs","email":"labs@pianobit.com"}],"dist":{"shasum":"a5dc82a2364d49a68c5191a914005e8d04a08407","tarball":"https://registry.npmjs.org/zen/-/zen-0.1.6.tgz","integrity":"sha512-xW9ycjzEBUkah4RE/PRx7lMDomM7Kgi+yE/6zBRRz9IMZpEQhrHLctz17F3IA2URl/3/+Q8vu0RoTktxvoiE9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAeTEisOH4Gb6cB6hRB48AeUYDEe+MSOF4CLk767MQbgIhAMjCR2B8ozbP2yU5KAJGRBZingxlH/cp+wQF2kMkjx/m"}]},"directories":{}},"0.1.7":{"name":"zen","version":"0.1.7","description":"is a simple, safe, basic, fast, general purpose module engine","keywords":["engine","stack","module","wsgi","rack","next"],"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"dependencies":{},"devDependencies":{"benchmark":"0.2.1","nodeunit":"*","stack":"^0.1.0","stack2":"^2.0.3"},"main":"zen.js","engines":{"node":">= 0.4.0"},"scripts":{"bench":"node bench/bench.js","test":"nodeunit"},"gitHead":"41d216f8272aae662e19e5d8508e0dc52cce88f7","bugs":{"url":"https://github.com/pblabs/zen/issues"},"homepage":"https://github.com/pblabs/zen#readme","_id":"zen@0.1.7","_npmVersion":"6.5.0","_nodeVersion":"10.21.0","_npmUser":{"name":"pblabs","email":"labs@pianobit.com"},"dist":{"integrity":"sha512-5njs6PLPDcMH+/mg9yv/hRcncck9mz6yLIs7iWQSMNM1KMmviCK9Yxiyj2N3QubSeI9Q7cDEhv5OawLUVM0AjQ==","shasum":"063f2f00ddf7c8c1f20f5840e91507b60dbcbfc8","tarball":"https://registry.npmjs.org/zen/-/zen-0.1.7.tgz","fileCount":18,"unpackedSize":131567,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6KEvCRA9TVsSAnZWagAADx4P/2udK3716uhQnQvVnWnz\ntsynF2pw6X4rFwfka2/t59w8yLQ4w4sOkRXiRh+avbjQdUnloQrgtCpyKU4i\nDwI3YjKrxmec0dUWjzhKhfM1kki5zCnrmaFWqSLL7tpn87JKnHBtOGbH/I1O\nYpgOAJjrE02+zvfZL+Erix684h3U4XL/ndMqgyfoDTlXTgjyXpfGIiyyo3ej\nAUxnCFLEpTb8zzlPhhhbHvb1cx2RrT+W1R/jBoFMu5xpRivXAVuFlEop1Jj1\ng9J4G5SB3b/9bXPGfm9z92L+0iQYV1IJJ5KVcgrKPPkNm6Q1xyOZhm2N/v+m\nSUecklmebQciH/0Ijz+HeYW1szYVA0QveBgMIq6p1EDv4k9pIQJRvbiEHAFm\nT6IlXBS+msC8Kh7gtNBaGwnHSBcf+vJQ2xa4HM+w9+1rIe5/PjZpQfmWd8Ju\nXhr3e8C9r8PgxqxLFQFmFiOyPQmOj4aXC25RFuI8Gd5pn4xufOU5P6TC5biC\nmFF5CvEn+iYfnDkswVR81BPp6OXI2/vm1tkPD6BxYM5sc+gWMlxAO31ELtCy\nFwY2JnvJkE32Gl3Eqc8TwYrJIKq1H48njs3tuQlfGIK2qz8B9Pd0L2Yr5SfT\n+G76xVgaGdISCLUCxZVccuRBltHUzpRtAVaQiSbl9GPvhWUTm3KVsYpt9yhQ\nyvTA\r\n=jNEL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGsnkhE8ecTxF03UErXGhZq9AlldnLvvd2A/QOxgzR0yAiBwKyEB9wRWWyoDE/Ky+BRSYPVwCg0Vr0vI4A4zXJi8kQ=="}]},"directories":{},"maintainers":[{"name":"pblabs","email":"labs@pianobit.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zen_0.1.7_1609081135002_0.051684059529941706"},"_hasShrinkwrap":false}},"maintainers":[{"name":"pblabs","email":"labs@pianobit.com"}],"time":{"modified":"2022-06-29T16:43:01.232Z","created":"2011-06-10T20:47:37.038Z","0.1.1":"2011-06-10T20:52:10.861Z","0.1.2":"2011-06-13T23:00:58.838Z","0.1.3":"2011-06-21T22:24:19.633Z","0.1.4":"2012-02-22T11:38:33.244Z","0.1.5":"2013-09-21T20:14:11.062Z","0.1.6":"2014-11-10T13:28:49.273Z","0.1.7":"2020-12-27T14:58:55.182Z"},"author":{"name":"pibi","email":"pibi@pianobit.com","url":"http://pianobit.com"},"repository":{"type":"git","url":"git://github.com/pblabs/zen.git"},"readme":"# <img src=\"https://github.com/pblabs/zen/raw/master/logo.png\"> Zen\r\n\r\n_Z-engine (Zen)_ is the most simple, safe, minimal, fast, full featured, general purpose javascript module stack engine for Node.js.\r\n\r\nBasically it's like Connect or Stack, but simpler and faster.\r\n\r\nZen comes into two flavours: zen-http and zen: \r\n- zen is a general purpose engine\r\n- zen-http is designed to be used for triadic modules (like http servers) where extreme performance is a requirement.\r\n \r\n## Install\r\n\r\nAs simple as\r\n\r\n    npm install zen\r\n\r\n## How to use\r\n\r\n\tvar zapp=require('../zen')(\r\n\t  require('firstHandler')(),\r\n\t  require('secondHandler')(handleArg1, handleArg2),\r\n\t);\r\n\t\r\n\tvar result = zapp(<proper>, <application>, <args>); \r\n\r\n## Explanation\r\n\r\n_Zen_ takes a list of handler functions and will chain them up by the next() method in a z-engine instance. \r\n\r\nEach handler needs to be of the form:\r\n\r\n    function handler(<proper>, <application>, <args>, next) {\r\n      // Either handle the request here using the arguments\r\n      // or call `next()` to pass control to next module\r\n\r\n\t  // next uses node.js callback convention: \r\n      // any exceptions need to be caught and forwarded to `next(err)`\r\n\t  // result needs to be forwarded with `next(null,res)`\t\r\n\r\n\t  // without a call to `next` Zen \"drops\" the chain  \r\n    }\r\n\r\nWhen using external modules we suggest to use the Setup Pattern, where the module is a callable function that returns the handler function.  \r\n\r\n    module.exports = function setup(<some>, <useful>, <setup>, args) {\r\n      // Do module setup stuff here\r\n      return function handler(<proper>, <application>, <args>, next) {\r\n        // Handle a request here\r\n      };\r\n    };\r\n\r\n## What Zen Does\r\n\r\n_Zen_ does a few things under the hood.\r\n\r\n - Creates standalone module engines. Multiple engines could be chained together.\r\n - Uses <a href='http://en.wikipedia.org/wiki/Continuation-passing_style'>continuation passing style</a>, but as long as an application stack uses `return next();` value returned from handle functions could be assigned to the caller.\r\n - Wraps handlers in a `try..catch` to catch any exception that happens running the engine.\r\n - Forwards errors and exceptions passed to any next module directly to the error handler.  This means module doesn't have to worry about errors from previous modules.\r\n - Forwards result passed to any next module directly to the result handler. This avoids generic result handling in module's business logic  \r\n\r\nerrorHandler and resultHandler could be overridden by custom functions. As handler above these needs to be of the form:\r\n\r\n\tzapp.errorHandler = function(<proper>, <application>, <args>, err) {\r\n\t}\r\n\tzapp.resultHandler= function(<proper>, <application>, <args>, res) {\r\n\t}\r\n\r\n## What Zen Does NOT Do\r\n\r\nDue its general purpose, _Zen_ does not provide any middleware modules of any kind.\r\n\r\n## API\r\n\r\n - `zapp.errorHandler` : this is the default request handler and the called handler on errors. Must be a function.\r\nWhen a `Handler` throws exception, this is catched by the original errorHandler (that prints on console).\r\n - `zapp.resultHandler` : this is the result handler. When it throws exception this is catched by the `errorHandler`.   \r\n - `zapp.pause` : pauses the engine and buffers the requests.\r\n - `zapp.stop` : stops the engine, requests will be forwarded to the errorHandler.\r\n - `zapp.resume` : resumes the engine and flushes the requests buffer on the engine.\r\n\r\n# Zen-http\r\n_zen-http_ is a special flavour of _Zen_ for triadic handlers (like http server). It includes proper HTTP result and error handlers and default 404 response. Connect and Stack compatible.\r\nUse `next(err)` to push a 500 error message to the client, `next(null,result)` to send the result with status 200.\r\n\r\n# Benchmarks\r\n\r\n_Zen_ flavours are faster than Stack and Stack2 on real world use cases\r\n\r\n<img src=\"https://github.com/pblabs/zen/raw/master/results.png\">\r\n\r\n# Conclusion\r\n\r\n_Zen_ is available on <a href='https://github.com/pblabs/zen'>github</a>\r\nunder <a href='https://github.com/pblabs/zen/blob/master/MIT-LICENSE.txt'>MIT license</a>. If you found bugs, please fill issues on <a href=\"https://github.com/pblabs/zen/issues\">github</a>. \r\nFeel free to fork, modify and have fun with it ;-)\r\n\r\n## Credits\r\n\r\n_Zen_ takes ideas from Connect and Stack\r\n","homepage":"https://github.com/pblabs/zen#readme","keywords":["engine","stack","module","wsgi","rack","next"],"bugs":{"url":"https://github.com/pblabs/zen/issues"},"readmeFilename":"README.md","users":{"pblabs":true}}