{"_id":"@bookmate/zipkin-express-helpers","_rev":"4-fa392e0baff7a593454d013eda1c5ef8","name":"@bookmate/zipkin-express-helpers","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bookmate/zipkin-express-helpers","version":"0.0.1","description":"Add zipkin headers to Express request object and read them back","main":"src/index.js","scripts":{"test":"jest","tdd":"jest --watchAll","prepublish":"npm test"},"repository":{"type":"git","url":"git+https://github.com/bookmate/zipkin-express-helpers.git"},"keywords":[],"author":"","license":"ISC","bugs":{"url":"https://github.com/azangru/zipkin-express-helpers/issues"},"homepage":"https://github.com/azangru/zipkin-express-helpers#readme","dependencies":{"lodash":"4.17.11","zipkin":"0.16.0"},"devDependencies":{"eslint":"5.13.0","eslint-plugin-jest":"22.2.2","jest":"24.0.0"},"gitHead":"a4585fa001243d5bd493b587859315558720d100","_id":"@bookmate/zipkin-express-helpers@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.14.2","_npmUser":{"name":"azangru","email":"andrey.azov@gmail.com"},"dist":{"integrity":"sha512-nLW1TDS4oXohcnWflMYQMqiGSrf2QVIkYbb+uc4X7uWtQZDv0jKPgkGM+FckDitATK6gAGK91tbZJIXAw3+4lg==","shasum":"203ccbfd63b42ac074dd99601d95f6537032ff97","tarball":"https://registry.npmjs.org/@bookmate/zipkin-express-helpers/-/zipkin-express-helpers-0.0.1.tgz","fileCount":7,"unpackedSize":6460,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWbtZCRA9TVsSAnZWagAA7eoP/j6yQb6SfxoWXJd0ZHiS\niZqTadi0FxWwZFH9YKgYN7KuUnmehh0Tg23kVcvsfoo66gjcMHM8bcnx+XDf\nH5P4IdgdLcs8WdxiV2X5B99bcVMeAm6rZlfBJP7Dmp2jmLDzHddmM4DxLXSJ\nydXAbEepEXqU5JGIAhdzruEvEulpJG/emZu1fMovmqmzV0ASBkdpUL/mkoHO\nU3a2JsIruBByxqPOGsnUNVuHY1E40MdZVF45/uAsl5mNraHAFX/KilbvrAJy\npDvaBMld7A0Kr9/ymZz/Hqy84GlvLZxyiQnYs9/sUKqBCvA+3walnx+0JBVC\nWbmM42GG0utrgAQt002NYaoiVW7me/mHSpVjbQDmrdx5hnjpSyQX7eNaL6Ai\nhNlCoaCI1jx8lWWD1iPxrQFZDkdnUpM+8KeBUQ8y2c1pRBjpnJRvEgSPQot9\njUmdRb6v4M5Lx2ODMSUZ7XdUSQopy6CUhaFbW74H69qnjIF5T+YS28ZgItag\naBpxuukkPdzJ61BwICuNJye3O3VBYKQyI4dirmK/g+SrsfE+qoi5grk7h5sN\np+LOO60Zol/JnWIfLotL/b/5h6I0fQg5KZgZx6v83rbnC1JU4I8U1nltiBYS\nCHKu9ptrA17FbDO9sok/0Ah+5MrM4XyxJBhlteDy73sDmpxjyRkZ5R6ZFPKS\nGbqo\r\n=9JjT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0rYg6ogHJukf8f6OcCBCFynVKtWRWVcQXeCPuYHbJ5gIgOCKq3M4MuEQYftBN/dfEhlVd0i85W+pQb3iQAxePPHM="}]},"maintainers":[{"name":"panya","email":"panyakor@gmail.com"},{"name":"bookmate-npm","email":"npm@bookmate.com"},{"name":"azangru","email":"andrey.azov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zipkin-express-helpers_0.0.1_1549384537248_0.12341103411696319"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-05T16:35:37.059Z","0.0.1":"2019-02-05T16:35:37.381Z","modified":"2022-04-04T20:07:36.813Z"},"maintainers":[{"email":"andorn@gmail.com","name":"andorn"},{"email":"npm@bookmate.com","name":"bookmate-npm"}],"description":"Add zipkin headers to Express request object and read them back","homepage":"https://github.com/azangru/zipkin-express-helpers#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/bookmate/zipkin-express-helpers.git"},"bugs":{"url":"https://github.com/azangru/zipkin-express-helpers/issues"},"license":"ISC","readme":"# zipkin-express-helpers\n\nInstruments for adding zipkin headers to an Express request object and for reading them back.\n\n## Installation\n\n`npm install --save @bookmate/zipkin-express-helpers`\n\n## Usage\n\nIf all you need is just to add zipkin headers to requests in Express (e.g. if you are using Express as a proxy), the most convenient way is to use a middleware:\n\n```javascript\nconst express = require('express');\nconst { createZipkinExpressMiddleware } = require('@bookmate/zipkin-express-helpers');\n\nconst localServiceName = 'name of this application';\n\nconst app = express();\n\napp.use(createZipkinExpressMiddleware({localServiceName}));\n```\n\nFor more fine-grained control, you may want to use ZipkinRequestDecorator (which is used in the middleware):\n\n```javascript\nconst express = require('express');\nconst { ZipkinRequestDecorator } = require('@bookmate/zipkin-express-helpers');\n\nconst localServiceName = 'name of this application';\nconst zipkinRequestDecorator = new ZipkinRequestDecorator({ localServiceName });\n\nconst customMiddleware = (req, res, next) => {\n  zipkinRequestDecorator.addZipkinHeadersToRequest(req);\n  // some custom logic\n  next();\n}\n\nconst app = express();\n\napp.use(customMiddleware);\n```\n\nTo read zipkin headers from a request, use `readZipkinHeadersFromRequest` function:\n\n```javascript\nconst { readZipkinHeadersFromRequest } = require('@bookmate/zipkin-express-helpers');\n\nfunction myFunc(req) {\n  const zipkinHeaders = readZipkinHeadersFromRequest(req);\n  // do something with the headers\n}\n```\n","readmeFilename":"README.md"}