{"_id":"express-async-wrap","_rev":"5-b76744316a17d1bc1f828fc84174bdf4","name":"express-async-wrap","description":"Allows the use of ES2016 async functions as Express route handlers","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"express-async-wrap","version":"1.0.0","description":"Allows the use of ES2016 async functions as Express route handlers","main":"lib/index.js","scripts":{"compile":"babel -d lib/ src/","lint":"eslint .","prepublish":"npm run compile","test":"JASMINE_CONFIG_PATH=specs/support/jasmine.json jasmine"},"repository":{"type":"git","url":"git+https://github.com/Greenfields/express-async-wrap.git"},"keywords":["express","async-await","routes"],"author":{"name":"Chris Shepherd","email":"chris.shepherd@uk.tesco.com"},"license":"MIT","devDependencies":{"babel":"^5.8.23","babel-eslint":"^4.1.1","eslint":"^1.3.1","express":"^4.13.3","jasmine":"^2.3.2","pre-commit":"^1.1.1","supertest":"^1.1.0"},"pre-commit":["lint","test"],"gitHead":"b9fff92cda4dddbacf893ccddcfec2f3b17a1bf9","bugs":{"url":"https://github.com/Greenfields/express-async-wrap/issues"},"homepage":"https://github.com/Greenfields/express-async-wrap#readme","_id":"express-async-wrap@1.0.0","_shasum":"f9972d2b726fe68c0daf0495b8fc2137c54457aa","_from":".","_npmVersion":"3.3.0","_nodeVersion":"0.12.7","_npmUser":{"name":"tesco","email":"chris.shepherd@uk.tesco.com"},"dist":{"shasum":"f9972d2b726fe68c0daf0495b8fc2137c54457aa","tarball":"https://registry.npmjs.org/express-async-wrap/-/express-async-wrap-1.0.0.tgz","integrity":"sha512-oRtG32/wXRS1Mk23dwetfEl+qExyHBEgy3k9GYFTfdsKDQEuJ+M4BBpznaEiYxxSv8cVEI/um+1X05nrxyQQLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtUaMq3Ga9k/8LvBk41KFxXJT4BBvQg7JNmly7dro60wIgZncvncR8rgC3wps1ELaXpou2uXAkPZ4mHfcM4XZTBQ8="}]},"maintainers":[{"name":"tesco","email":"chris.shepherd@uk.tesco.com"}],"directories":{}}},"readme":"# express-async-wrap\nAllows the use of ES2016 async functions as Express route handlers.\n\n## Install\n\n```javascript\nnpm i express-async-wrap\n```\n\n## Usage\n\nTo use in place of a normal route handler:\n\n```javascript\nimport wrap from 'express-async-wrap';\n\nfunction makeResult(result) {\n  return new Promise((resolve) => {\n    setTimeout(() => resolve(result), 10);\n  });\n}\n\napp.get('/', wrap(async function(req, res) {\n  const results = [];\n\n  for(let i = 0; i < 5; i++) {\n    results.push(makeResult(`test${i}`));\n  }\n\n  res.send((await* results).join());\n}));\n```\n\nTo use as an error handler:\n\n```javascript\nimport wrap from 'express-async-wrap';\n\napp.get('/', wrap(async function(req, res, next) {\n  next(new Error('error'));\n}));\napp.use(wrap(async function(err, req, res, next) {\n  res.status(500).send('error');\n}));\n```\n","maintainers":[{"name":"tesco","email":"chris.shepherd@uk.tesco.com"}],"time":{"modified":"2022-06-17T22:08:37.214Z","created":"2015-09-04T15:09:04.729Z","1.0.0":"2015-09-04T15:09:04.729Z"},"homepage":"https://github.com/Greenfields/express-async-wrap#readme","keywords":["express","async-await","routes"],"repository":{"type":"git","url":"git+https://github.com/Greenfields/express-async-wrap.git"},"author":{"name":"Chris Shepherd","email":"chris.shepherd@uk.tesco.com"},"bugs":{"url":"https://github.com/Greenfields/express-async-wrap/issues"},"license":"MIT","readmeFilename":"README.md","users":{"felixfbecker":true,"mjurincic":true}}