0.0.3 • Published 4 years ago

jfaas v0.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago
jfaas.call('myAmazonfunc', { a: 1 }, { amazon: { ...config }})
jfaas.call('myGooglefunc', { a: 1 }, { google: { ...config }})

Install

Requires NodeJS >= 10.2.0

npm i jfaas

Usage

jfaas.call returns a Promise that resolves to an Object of what the FaaS function returned.

const jfaas = require('jfaas')

// If it's a Google Cloud Function
jfaas.call('mygreetingfunction', { name: 'Jon Doe' }, { 
  google: { 
    projectName: 'myproject',
    region: 'us-central1'
  } 
})
  .then(resObject => console.log(resObject))


// If it's a Amazon Lambda Function
jfaas.call('mygreetingfunction', { name: 'Jon Doe' }, { 
  amazon: {
    region: 'us-east-2'
  }
})
  .then(resObject => console.log(resObject))

// { message: 'Hello, Jon Doe' }
// { message: 'Hello, Jon Doe' }

ES2015

import jfaas from 'jfaas'

jfaas.call(...)
import { call } from 'jfaas'

call(...) 

License

MIT