mrbusche.com

Testing Node AWS Lambda handler function locally

Add a script to your package.json file

"scripts": {
    "local": "node -e \"console.log(require('./index').handler({}));\""
}

where index is the name of your js file with the code you want to execute

You can execute this script by running

npm run local