Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

worotyns/iron-functions-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

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'
  }
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published