Skip to content

QR Code generator function for the FaaS Platform in #golang

License

Notifications You must be signed in to change notification settings

faas-and-furious/qrcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaaS qrcode

Go Report Card

This repo contains an example FaaS function which uses the skip2/go-qrcode Go library to generate a QR Code for a string.

Deploying the Function

Make sure you have deployed a FaaS stack to your cluster using the instructions on the FaaS repo.

Use the CLI (faas-cli)

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

Testing the Function

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)