1.0.6 • Published 6 years ago

iron-functions-wrapper v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

iron-functions-wrapper

Sample wrapper for node iron functions turn this:

const fs = require('fs');

module.exports = function(fn) {
  let body;

  try {
    body = JSON.parse(fs.readFileSync('/dev/stdin').toString())
  } catch(error) {
    console.error(error);
    body = {}
  }

  console.log(JSON.stringify(body))
};

into this:

const handler = require('iron-functions-wrapper');

handler(async function(body){
  if (body.someProp) {
    return {
      success: true,
    }
  }

  return {
    error: 'someProp is required'
  }
});
1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago