{"_id":"@azangru/zipkin-express-helpers","_rev":"1-f52e801cbcce62fc3b0f51b514ad35f6","name":"@azangru/zipkin-express-helpers","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@azangru/zipkin-express-helpers","version":"0.0.1","description":"Instruments for adding zipkin headers to an Express request object and for reading them back.","main":"src/index.js","scripts":{"test":"jest","tdd":"jest --watchAll","prepublish":"npm test"},"repository":{"type":"git","url":"git+https://github.com/azangru/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.12.1","eslint-plugin-jest":"22.1.3","jest":"24.0.0"},"gitHead":"37da30c636a5c00668a9f923e699ff579e0b906f","_id":"@azangru/zipkin-express-helpers@0.0.1","_nodeVersion":"10.13.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-5OAR8BBxV60cR5g7dd/W1Vt05Dz1PzSAE+Dtg3IMtbOhAkZigHzof1v2eXj0O2Gvg3KlHMBPV6C1USil72SQ5A==","shasum":"e9c085563909fdcc83a693a653ff042bf44b7975","tarball":"https://registry.npmjs.org/@azangru/zipkin-express-helpers/-/zipkin-express-helpers-0.0.1.tgz","fileCount":7,"unpackedSize":6391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcTirtCRA9TVsSAnZWagAAAIEQAJfyaUeXeaVn+2yq9cP0\nIjOxpit4EFGJRWfpVd37oZgFnmU2O0X020AWp7GLOW1HuPFOr2Fd/88Wl2Yi\nG69dVZTTYgdvrL6mdS9TgT44kXqv/c8rPbXkwMI3OdmIdxNityaaWczD+YJH\nCn3/gRiLffO5naMrxW2vprqYt1Vush5hNDbZzEtX3vwoySnMXdX6YglQjkcK\nLbEMJjOaVH4d2G34oLcZ5PDi1VfVa4Bp5xaBwuSlBBTQiNaG2a21ysiwrqtY\ndb2iNNffMzHqjOjPGQ+cHmciAg2mRFxRTQ/tnqFF3tUMJXQ5S4cmJQwU6wL9\n8HHla1iCND2k8JD0ftx+zY97pUa9YtvNL0SxMZDICsCcJnsuNHL2yEn4wWv/\ncGxLoVOznOdf4xnm4pvOTrR3AdPkRw1kte2kXxidOUhNPpdPZLCehGlIZ5yM\nd+CPCkqWREehF1OukrkmybQSR7dCWgMx/8GeQjM7zBQ+vzrqrETMPIv6yn4Q\n6xdOn5wGxaf339LQzdl7kAxXkYtla4w0gtLHx3TRIdaZnSPovCB4/trDyG5x\n6dcelztD9PLmHM87D5eyicchA8sWH+lsiM9ya112kMNpGtIxnFpozCVhUsJM\n6kKfVhtkEvhGmCtw6CCXTjtFNS+ZRTggEKalFUnbx//zq2p5AmI1CfxN90ma\nu05x\r\n=Nso5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKiNVov7ejxkNk2Fx1txdnAb8c//f9nJSk1VheDiHorAIgU8kq1pX1EvLQiL/8MCh93rFGi6722eDNH4DDsXVA8f4="}]},"maintainers":[{"name":"azangru","email":"andrey.azov@gmail.com"}],"_npmUser":{"name":"azangru","email":"andrey.azov@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zipkin-express-helpers_0.0.1_1548626669143_0.534366528737731"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-27T22:04:28.975Z","0.0.1":"2019-01-27T22:04:29.256Z","modified":"2022-04-04T17:15:22.652Z"},"maintainers":[{"name":"azangru","email":"andrey.azov@gmail.com"}],"description":"Instruments for adding zipkin headers to an Express request object and for reading them back.","homepage":"https://github.com/azangru/zipkin-express-helpers#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/azangru/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 @azangru/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('@azangru/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('@azangru/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('@azangru/zipkin-express-helpers');\n\nfunction myFunc(req) {\n  const zipkinHeaders = readZipkinHeadersFromRequest(req);\n  // do something with the headers\n}\n```\n","readmeFilename":"README.md"}