{"_id":"@ematipico/middy-request-response","_rev":"2-03ff1c77e501f2671ef78a1ae077b6ec","name":"@ematipico/middy-request-response","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@ematipico/middy-request-response","version":"1.0.0","description":"Creates a pair request/response objects from AWS lambda","main":"lib/index.js","publishConfig":{"access":"public"},"scripts":{"test":"jest","test:ci":"jest --coverage","release":"standard-version","lint":"eslint ./src --ext .ts","build":"tsc"},"repository":{"type":"git","url":"git+https://github.com/ematipico/middy-request-response.git"},"engines":{"node":">=10"},"keywords":["middy","AWS","API Gateway"],"author":{"name":"emanuele"},"license":"MIT","bugs":{"url":"https://github.com/ematipico/middy-request-response/issues"},"homepage":"https://github.com/ematipico/middy-request-response#readme","peerDependencies":{"@middy/core":"1.0.0"},"devDependencies":{"@middy/core":"1.0.0","@types/aws-lambda":"8.10.51","@types/jest":"25.2.1","@types/node":"13.13.4","@typescript-eslint/eslint-plugin":"^2.31.0","@typescript-eslint/parser":"^2.31.0","eslint":"6.8.0","eslint-config-prettier":"6.10.0","eslint-plugin-node":"11.0.0","eslint-plugin-prettier":"3.1.2","jest":"25.5.4","prettier":"2.0.5","standard-version":"7.1.0","ts-jest":"25.4.0","typescript":"3.8.3"},"gitHead":"907fea56e5c3ee575da488b745201832d83b5d98","_id":"@ematipico/middy-request-response@1.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-y6s6UGXPIB0cD4M1D/ob/YO1+YO8XWb3iy1ErIsRWhgtSQ0VHudalQYIc7UyEnw2gPdVcjlxejx+/VGYGCQEPw==","shasum":"82b532cb4b00fbb4b578d3ba95597805a5c4dad8","tarball":"https://registry.npmjs.org/@ematipico/middy-request-response/-/middy-request-response-1.0.0.tgz","fileCount":5,"unpackedSize":4951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJesTrwCRA9TVsSAnZWagAAnT8QAIMin9cNSqmgXeDE1Gav\n1DdXA6GkC9ypOekVKAFzs5g/Wit7swv1h1edyZHl1VLlSNDjG+X9Da8xj1vS\nD61BCFHzdo8ODNzYNyUPeKlzXdX4UhnAax9EBsfViGu9DtRqUaRM4izXRq1q\nyTeiOMwG6YN0L0aIIBGMpElylU1M0QSCgI4J4ByZJ0sNq1Yf56e5u8DxYOuv\njelQ0XzZE0/d2n1LCD/Erqzv1LmKRavLVoJ73sJuZlkdeFpvO/nwkIfOiWD6\n96QFkUqoUCIO/ZuLd7Z2kiueYCAuoY+HygqMIC8ispTExmyNJulPQNCBUIer\nyyFRKT7ezVDqSR5OllyRUuwLnBMcETZ/elpYVwHryaeRoqqq4n8M94cARQBw\nLMrpSCRyO9rT26ut6y1Ouy8u0wRp1hhXtVftkrvlGyZ9KTUS1QIoa19MwX6b\n05PUF1UxkxzFPqmJgMSD5PXO0uubcCKyL6fPMtPM7NRCGNbrGBgb+daJCXSa\nZRLyyDYpzd4y70w9GjdzOx2TlAJtjdsnuxFVdTHGuujDlg1K0pIUSYTtiizg\n/K5yyl4GUNp/JSq4VUAdh2Xo+cnS8o0IwkeGNhnIy37UtxzfQAGd2sLX2fUe\nG09WSakCnhIdwD7b0ww0Mp0cHSA07kaOxbvD5nWgntdougu5borfrhwUrkWo\nsVVe\r\n=3P0o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICruwBXOCfUrM23M7lQP2X172bEH+AwwZGjADheaaMMyAiBmmcwv4CocKSUXsk0h7Bi2uObr38kixVin9W7hawtqFw=="}]},"maintainers":[{"name":"ematipico","email":"my.burning@gmail.com"}],"_npmUser":{"name":"ematipico","email":"my.burning@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middy-request-response_1.0.0_1588673263839_0.024211740687548167"},"_hasShrinkwrap":false},"1.0.1":{"name":"@ematipico/middy-request-response","version":"1.0.1","description":"Creates a pair request/response objects from AWS lambda","main":"lib/index.js","publishConfig":{"access":"public"},"scripts":{"test":"jest","test:ci":"jest --coverage","release":"standard-version","lint":"eslint ./src --ext .ts","build":"tsc"},"repository":{"type":"git","url":"git+https://github.com/ematipico/middy-request-response.git"},"engines":{"node":">=10"},"keywords":["middy","AWS","API Gateway"],"author":{"name":"emanuele"},"license":"MIT","bugs":{"url":"https://github.com/ematipico/middy-request-response/issues"},"homepage":"https://github.com/ematipico/middy-request-response#readme","peerDependencies":{"@middy/core":"1.0.0"},"devDependencies":{"@middy/core":"1.0.0","@types/aws-lambda":"8.10.51","@types/jest":"25.2.1","@types/node":"13.13.4","@typescript-eslint/eslint-plugin":"^2.31.0","@typescript-eslint/parser":"^2.31.0","eslint":"6.8.0","eslint-config-prettier":"6.10.0","eslint-plugin-node":"11.0.0","eslint-plugin-prettier":"3.1.2","jest":"25.5.4","prettier":"2.0.5","standard-version":"7.1.0","ts-jest":"25.4.0","typescript":"3.8.3"},"gitHead":"7e53eab18cfeccd1550c4a12ee67d5ef672f74b5","_id":"@ematipico/middy-request-response@1.0.1","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-as6asig2u/yFpj8zwIwVSVG/B+f1ZAzUSaRYK4Bh0m6gCLgpQJ37O4skTnV4+6Kt5hJ1lHOXqCxCburMR0DMkw==","shasum":"70e596d286320ac2b3d41bfb13e692945f9d7d37","tarball":"https://registry.npmjs.org/@ematipico/middy-request-response/-/middy-request-response-1.0.1.tgz","fileCount":13,"unpackedSize":13790,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJesTtfCRA9TVsSAnZWagAA6DMP/j75IVxcDHYA+pEbDYcz\nocyX3wwUOrs+Ez190qWM/M651QcB9rkxP3iG1KlH66uzmjX6RVfJmEkheiLE\nN43Sfik82MRppYRgiYqKhKdFeeRT6/ikuZi7A6eyR1KT9Qa6P9V7PJBz+iJm\nMY6vyMooeUnSsXSt7iMO3wOe9vXstcxbzKqDVXYEJGeQ0XnBI5RlkpY8naiu\nP42cG3cEuFp1cGs2j3HigunvZLp0564axgov8WQ7XUaKqnMxn8spsOn9yPho\nIpaAnmjNzM9aZEnVGh9nhthpDzBTlaVtgEVEV2xT5Tt+k2ck3wb/EGCR8RRA\nZEyPHUIk9LZkFV+qWy4aqazz8aXTm0OJzNP3Ouf3BFUNQUs05uQHVbU2qfCv\nhESdj5t5soEK62Un3eGKWbBeyrWyHqG0gDIhQlT+X+EUWXIPUzUh8GF5vU/h\n7K2/qMPIHuH9qGjsd3QB+srD+1BhJSRVH1Sm8/fOgX5TyVxffvidhdKBCdqV\n8EH+lSjjH6y8ndqVyHTsqJ/DcgcPPPwOxGMaVMYZLeUDzVaQBTK72oCV/JUm\njSD9bd/c5YoErD6YeZcCDNroxKEOVAhfTWpNgOe27G85dTcHmwktyYGE8m7N\nvOdYgC/OwuvMdfxpWNytgyVoZSLs0JKVnLLRjaqomKUvjgZG5ZO3/5SDLC6A\nSZl5\r\n=D5sw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDq/dmZt6GYfLJRn7k3r/L9UqoElF39O9gpIqdIwR8BBAIhALoCA6WX6uRuos+2IeTjEIChWGznBNQ8F9L1UyIgW8mP"}]},"maintainers":[{"name":"ematipico","email":"my.burning@gmail.com"}],"_npmUser":{"name":"ematipico","email":"my.burning@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/middy-request-response_1.0.1_1588673375058_0.5484915280325158"},"_hasShrinkwrap":false}},"time":{"created":"2020-05-05T10:07:43.803Z","1.0.0":"2020-05-05T10:07:43.994Z","modified":"2022-04-05T07:28:08.177Z","1.0.1":"2020-05-05T10:09:35.182Z"},"maintainers":[{"name":"ematipico","email":"my.burning@gmail.com"}],"description":"Creates a pair request/response objects from AWS lambda","homepage":"https://github.com/ematipico/middy-request-response#readme","keywords":["middy","AWS","API Gateway"],"repository":{"type":"git","url":"git+https://github.com/ematipico/middy-request-response.git"},"author":{"name":"emanuele"},"bugs":{"url":"https://github.com/ematipico/middy-request-response/issues"},"license":"MIT","readme":"# middy-request-response\n\nCreates a request/response objects from API Gateway event.\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Why](#why)\n- [Where](#where)\n\n\n## Installation\n\n```bash\nnpm i @ematipico/middy-request-response\n```\n\nOr\n\n```bash\nyarn add @ematipico/middy-request-response\n```\n\n## Usage\n\n```javascript\nconst middy = require('middy/core');\nconst requestResponse = require('@ematipico/request-response');\n\nconst renderRequest = (event, context) => {\n  const { response } = context;\n\n  response.statusCode = 200;\n  response.end('<html></html>');\n}\n\nconst handler = middy(renderRequest)\n  .use(requestResponse()) // parses the request body when it's a JSON and converts it to an object\n\nmodule.exports = { handler }\n\n```\n\n## Why\n\nThe reason why I created this package, is that because sometimes it is difficult to unify a lambda environment with a\nusual server where most of the people are comfortable with.\n\nMost of the times we create a local server inside the lambda.\n\nThis middleware wants to mimic the same behaviour without creating a local server. The middleware creates two objects \ncalled `response` and `request` and will try to mimic as much as possible the behaviours of\n [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage)  and   \n[`http.ServerResponse`](https://nodejs.org/api/http.html#http_class_http_serverresponse).\n\n## Where\n\nThis middleware can be used in advanced frontend cases where you want to store your pages on a lambda, and you'd need a \n`request` and `response` objects to feed to your frontend frameworks such as Next.js or Nuxt.js.\n","readmeFilename":"README.md"}