npm.io
0.0.3 • Published 6 years ago

jfaas

Licence
ISC
Version
0.0.3
Deps
2
Size
4 kB
Vulns
1
Weekly
0

jFaaS

Unified wrapper for calling different FaaS providers

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