This repo contains an example FaaS function which uses the skip2/go-qrcode Go library to generate a QR Code for a string.
Make sure you have deployed a FaaS stack to your cluster using the instructions on the FaaS repo.
Get the CLI
The faas-cli can be installed via brew install faas-cli
or curl -sSL https://get.openfaas.com | sudo sh
.
Now deploy the function as follows:
# faas-cli -action deploy -image=faasandfurious/qrcode -name=qrcode -fprocess="/usr/bin/qrcode"
200 OK
URL: http://localhost:8080/function/qrcode
Now that the function is running in your FaaS environment you can test it from the command line by running:
$ curl localhost:8080/function/qrcode --data "https://github.com/alexellis/faas" > qrcode.png
You can check the QR code works using your phone, or an online QR Code decoder (ZXing Decoder Online for example)