{"id":13411343,"url":"https://github.com/BackendStack21/http-lambda-proxy","last_synced_at":"2025-03-14T17:30:35.885Z","repository":{"id":55895411,"uuid":"251323992","full_name":"BackendStack21/http-lambda-proxy","owner":"BackendStack21","description":"HTTP to AWS Lambda proxy","archived":false,"fork":false,"pushed_at":"2020-12-08T21:34:43.000Z","size":104,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-20T03:19:43.107Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BackendStack21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-30T14:06:22.000Z","updated_at":"2024-01-26T08:43:23.000Z","dependencies_parsed_at":"2022-08-15T08:50:49.960Z","dependency_job_id":null,"html_url":"https://github.com/BackendStack21/http-lambda-proxy","commit_stats":null,"previous_names":["jkyberneees/http-lambda-proxy"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendStack21%2Fhttp-lambda-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendStack21%2Fhttp-lambda-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendStack21%2Fhttp-lambda-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BackendStack21%2Fhttp-lambda-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BackendStack21","download_url":"https://codeload.github.com/BackendStack21/http-lambda-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618590,"owners_count":20320263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:13.033Z","updated_at":"2025-03-14T17:30:35.622Z","avatar_url":"https://github.com/BackendStack21.png","language":"JavaScript","funding_links":["https://www.paypal.me/kyberneees"],"categories":["Web Development"],"sub_categories":["Javascript"],"readme":"# http-lambda-proxy\nNode.js library that allows to proxy HTTP requests to AWS Lambda functions. The goal is to empower developers to consider step by step migration of endpoints/workflows and even fully featured HTTP/REST services into serverless.\n\n## What is AWS Lambda?\n[![AWS Lambda](https://img.youtube.com/vi/eOBq__h4OJ4/0.jpg)](https://www.youtube.com/watch?v=eOBq__h4OJ4 \"AWS Lambda\")\n\n## Install\n```js\nnpm i http-lambda-proxy\n```\n\n## Usage\nThe following example describe how to use `http-lambda-proxy` with `restana`:\n```js\nconst lambdaProxy = require('http-lambda-proxy')\nconst proxy = lambdaProxy({\n  target: process.env.FUNCTION_NAME,\n  region: process.env.AWS_REGION\n})\n\nconst service = require('restana')()\nservice.all('/*', (req, res) =\u003e { \n  proxy(req, res, req.url, {}))\n}) \n\nservice.start(8080)\n```\n\u003e In this example, we proxy all http requests on port 8080 to an AWS Lambda function.\n\n### Example lambda function implementation:\n```js\nconst serverless = require('serverless-http')\nconst json = require('serverless-json-parser')\nconst query = require('connect-query')\n\nconst service = require('restana')()\nservice.use(query())\nservice.use(json())\n\n// routes\nservice.get('/get', (req, res) =\u003e {\n  res.send({ msg: 'Go Serverless!' })\n})\nservice.post('/post', (req, res) =\u003e {\n  res.send(req.body)\n})\n\n// export handler\nmodule.exports.handler = serverless(service)\n```\n\n## API\n### Options\n#### `region *`\nSet the AWS Region of the target downstream lambda.\n#### `target *`\nAWS Lambda funcion name, version, or alias.\n#### logType\nSet to \"Tail\" to include the execution log in the response. Default: \"None\"\n#### qualifier\nSpecify a version or alias to invoke a published version of the function.\n#### clientContext \nUp to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.\n#### lambdaProxy\nFunction wrapper to AWS Lambda invocation proxy. Allows to overwrite default implementation.\n\u003e Any other AWS.Lambda constructor option is allowed: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html\n\n---\nMore details on `aws-sdk / lambda / invoke`: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html#invoke-property\n\n## Proxying \n```js\nproxy(\n  originReq,                          // http.IncomingMessage \n  originRes,                          // http.ServerResponse\n  req.url,                            // Request URL\n  {}                                  // Options described below\n)\n```\n### Options\n#### onResponse(req, res, response)\nCalled when the remote lambda response is received. If defined, default behavior is overwritten. \n\n#### rewriteHeaders(headers)\nCalled to rewrite the headers of the response, before them being copied over to the outer response. It must return the new headers object.\n\n## Supported response formats\nThe following alternatives describe the supported response formats:\n- Ideally, your lambda function is implemented using the [serverless-http module](https://github.com/dougmoscrop/serverless-http), so you can run fully featured Node.js REST/HTTP services as AWS Lambda funtions. \n- Your lambda respond using a JSON Payload with the following format:\n  ```js\n  {\n    \"headers\": {\n      // ...\n    },\n    \"statusCode\": 200,\n    \"body\": // ...\n  }\n  ```\n- Your lambda respond with a JSON Payload and it contains a `body` property:\n  ```js\n  exports.handler = async function () {\n    return JSON.stringify({\n      body: \"Hello World!\"\n    })\n  }\n  ```\n\u003e The lambda function implementation is NOT restricted to Node.js, you can use any of the supported [AWS Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).\n\n## Related topics\n- fast-gateway: https://www.npmjs.com/package/fast-gateway\n- fast-proxy: https://www.npmjs.com/package/fast-proxy\n\n## License\nMIT\n\n## Sponsors\n- (INACTIVE) Kindly sponsored by [ShareNow](https://www.share-now.com/), a company that promotes innovation! \n\n## Support / Donate 💚\nYou can support the maintenance of this project: \n- Paypal: https://www.paypal.me/kyberneees\n- NANO Crypto Coin: `nano_3zm9steh8mb374f8be3rbytqhgzzarczhwtxhihkqt83a4m46oa3xidfiauc`\n- XRP Crypto Coin: `rarQgNuiqF9gFLLwd5fdku4jYa9EXpiyCp`\n- TRON Crypto Coin: `TJ5Bbf9v4kpptnRsePXYDvnYcYrS5Tyxus`\n- BITCOIN Crypto Coin: `bc1qcrr58venyh54ztvkqym39p9rhnxg4308t0802f`\n- Ethereum Crypto Coin: `0xD73c8E63a83eBD8Df3fB3d0090f1fe7a1eEB980B`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBackendStack21%2Fhttp-lambda-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBackendStack21%2Fhttp-lambda-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBackendStack21%2Fhttp-lambda-proxy/lists"}