Giter Site home page Giter Site logo

local-node-lambda's Introduction

Local-Node-Lambda

Local-Node-Lambda lets you run Amazon Lambda functions locally. You can run them from the command line or integrate calls within a regular Node.js script, e.g. to use in unit testing or simply as part of a regular application.

Install

# For command line use
npm install -g local-node-lambda
# For Node.js use
npm install local-node-lambda

Usage

# Run from Node.js
var localNodeLambda = require('local-node-lambda');

localNodeLambda.invoke(<eventObj>, <path>, <handler>, <timeout>, function (err, message) {
	if (err) {
		console.log(err);
	} else {
		console.log(message);
	}
	process.exit();
});
# Run from command line
local-node-lambda

Command Line Help

Parameters

  • -p, --path [Lambda file name] Specify Lambda function file name. Default is "./index"
  • -e, --eventPath [Event data file name] Specify event data file name. Default is "{}"
  • -h, --handler [Lambda handler name] Lambda handler name. Default is "handler".
  • -t, --timeout [Timeout seconds] Seconds until the Lambda function times out. Default is 3 seconds.

Event data

From the regular node execution you can pass in a JSON object as the event object, while from the command line you can pass in a js file that exports a JSON object.

# Command line sample event
module.exports = {
	hello: "world"
};

Inspiration

License

This library is released under the MIT license.

local-node-lambda's People

Watchers

Brian McKenzie avatar James Cloos avatar Stephen Bolen avatar james avatar Marshall Margenau avatar Eyal Shacham avatar Pratik Patel avatar Dev-Frank Cui avatar jey avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.