const OpenFaaS = require('openfaas')
// Send in a gateway URL
const openfaas = new OpenFaaS('http://localhost:8080')
// Also supports any `request` library options
const clientWithAuth = new OpenFaaS('http://localhost:8080', {
auth: {
user: "jane",
pass: "123"
}
})
// Deploy
openfaas
.deploy(
'yolo', // name your function
'hello-serverless' // choose the Docker image
'func_functions', // choose your network (optional)
)
.then(x => console.log(x))
.catch(err => console.log(err))
// Invoke
openfaas
.invoke(
'yolo', // function name
'hello world', // data to send to function
true, // should response be JSON? Optional, default is false
false // should the response by binary? Optional, default is false
)
.then(x => console.log(x)) // handle response
.catch(err => console.log(err))
// Remove
openfaas
.remove('yolo')
.then(x => console.log(x)) // handle response
.catch(err => console.log(err))
// Chain functions together
openfaas
.compose('initial data', [
'func_nodeinfo',
'func_echoit',
'func_wordcount'
])
.then(x => console.log(x.body)) // handle final output
.catch(err => console.log(err))
forked from openfaas-incubator/node-openfaas
-
Notifications
You must be signed in to change notification settings - Fork 0
alexking/node-openfaas
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- JavaScript 100.0%