Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Latest commit

 

History

History
44 lines (37 loc) · 1.09 KB

README.md

File metadata and controls

44 lines (37 loc) · 1.09 KB

XO code style OpenFaaS

Usage
const OpenFaaS = require('openfaas')

const openfaas = new OpenFaaS('http://localhost:8080')

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))

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))

openfaas
	.remove('yolo')
	.then(x => console.log(x)) // handle response
	.catch(err => console.log(err))

openfaas
	.compose('initial data', [
		'func_nodeinfo',
		'func_echoit',
		'func_wordcount'
	])
	.then(x => console.log(x.body)) // handle final output
	.catch(err => console.log(err))