Skip to content

developius/node-openfaas

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XO code style OpenFaaS

Usage

Add openfaas via npm

$ npm install openfaas --save

Example usage

const OpenFaaS = require('./openfaas')

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

openfaas.deploy(
	'yolo', // name your function
	'func_functions, // choose your network
	'hello-serverless // choose the Docker image
)
	.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
)
	.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))
ToDo
  • Complete tests
  • support additional request options for got

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%