1.0.0 • Published 8 years ago
json-config-lambda-handler v1.0.0
json-config-lambda-handler
const withConfig = require('json-config-lambda-handler');
function handleEvent({ event, config }, callback) {
console.log('event = ', event);
console.log('config = ', config);
callback(null);
}
exports.handle = withConfig(handleEvent);module.exports(handler)
handler<Function> called when the handler is invokedargs<Object>event<Object> AWS Lambda uses this parameter to pass in event data to the handlercontext<Context Object> AWS Lambda context objectconfig<Object> parsed JSON configuration
callback<Function> invoke to return info back to callererror<Error> an optional parameter that you can use to provide results of the failed Lambda function execution. When a Lambda function succeeds, you can pass null as the first parameter.result<Object> an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. If an error is provided, this parameter is ignored.
module.exports(environmentVariable, handler)
environmentVariable<String> an optional parameter containing environment variable name used to store the configuration. If not used, a default value ofCONFIGis used.handler<Function> called when the handler is invokedargs<Object>event<Object> AWS Lambda uses this parameter to pass in event data to the handlercontext<Context Object> AWS Lambda context objectconfig<Object> parsed JSON configuration
callback<Function> invoke to return info back to callererror<Error> an optional parameter that you can use to provide results of the failed Lambda function execution. When a Lambda function succeeds, you can pass null as the first parameter.result<Object> an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. If an error is provided, this parameter is ignored.