Nasty Popsicle Machine

    @vissree_s/cfn-response-async

    0.0.1 • Public • Published

    README

    This package is an async version of cfn-response module.

    The module includes a send method, which sends a Custom resource response object corresponding to the received request object and returns a promise, so that it can be used within Async nodejs handlers.

    Sample usage

    const response = require("cfn-response-async");
    
    async function someAsyncLogicToRun() {
      return "All good!";
    }
    
    exports.handler = async (event, context) => {
      console.log(event);
      console.log(context);
    
      var res;
    
      try {
        const outputValue = await someAsyncLogicToRun();
        const responseData = {
          Value: outputValue,
        };
    
        res = await response.send(event, context, response.SUCCESS, responseData);
      } catch (error) {
        console.log(error);
        res = await response.send(event, context, response.FAILED);
      }
    
      console.log("Status code: " + res.statusCode);
      console.log("Status message: " + res.statusMessagee);
      return res.statusCode;
    };

    Install

    npm i @vissree_s/cfn-response-async

    DownloadsWeekly Downloads

    1

    Version

    0.0.1

    License

    SEE LICENCE IN LICENCE.md

    Unpacked Size

    38.5 kB

    Total Files

    4

    Last publish

    Collaborators

    • vissree_s