Nearly Picked Makefiles

    json-config-lambda-handler

    1.0.0 • Public • Published

    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 invoked
      • args <Object>
        • event <Object> AWS Lambda uses this parameter to pass in event data to the handler
        • context <Context Object> AWS Lambda context object
        • config <Object> parsed JSON configuration
      • callback <Function> invoke to return info back to caller
        • error <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 of CONFIG is used.
    • handler <Function> called when the handler is invoked
      • args <Object>
        • event <Object> AWS Lambda uses this parameter to pass in event data to the handler
        • context <Context Object> AWS Lambda context object
        • config <Object> parsed JSON configuration
      • callback <Function> invoke to return info back to caller
        • error <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.

    Keywords

    none

    Install

    npm i json-config-lambda-handler

    DownloadsWeekly Downloads

    6

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • drudge