0.0.3 • Published 4 years ago

lambda-proxy-server v0.0.3

Weekly downloads
11
License
ISC
Repository
github
Last release
4 years ago

lambda-proxy-server

Standalone, minimalistic server and listener for simulating API Gateway Lambda Proxy integration.

For Node.js Lambdas only.

Note: For local development only. Many API Gateway features are missing.

Features:

  • Compatible with: aws-serverless-express and lambda-api
  • Standalone - run without SAM CLI or Serverless Framework
  • Listener support - bring your own server or attach to router.
  • POST body data support

Usage

Install:

npm install lambda-proxy-server

There are multiple ways in which you can use this module:

  • Create a server script:
const server = require("lambda-proxy-server").createServer({
    handler: require("./path/to/lambda")["methodName"]
});
server.listen(8080, function () {
    console.log("Listening on http://localhost:" + server.address().port + "/");
});
  • Or, use the "run" script:
export LAMBDA_PATH="`pwd`/mylambda/handler"; \
export LAMBDA_FUNC="run"; \
export PROXY_PORT="8907"; \
node ./node_modules/lambda-proxy-server/run

Credits

Based on this gist by Sleavely.