qrfn : QR codes and Azure functions

Fallthrough the blog.

QR code?I think QR code as a gateway to from the “real world” to the “internet”.

 We see QR Codes being used in many ways, in movie/event tickets, in Payments, WIFI network login etc.

But what’s a blog on QR without it’s full form right? It’s known as Quick Response Code.

QChain – QR Enabled KeychainWe made QChain in an Experiment which was startup for a Week.

We thought of an idea in 12 Hours and Executed it whole week long.

Qchain gives you hope of finding lost key by just having a QR with the useful information of the owner.

To gather customers we generated funds by Crowdfunding and started Delivering their Product after a Week.

We used to 3D print the case and Print the QR code on a Sticker Page, cut it and Paste it on the Case.

We couldn’t Automate the hardware, but the Software, ofcourse I had Azure functions.

In form where people used to Pay us and Submit their information, I sent the submission to QRFn to generate their QR’s on the event(awesome r8).

Moreover when I Built Cliniq , I used QRfn while building the service for patients to book appointments.

The idea behind Cliniq was to skip long waiting queues to see the doctor.

Patient portal can generate QR code with a Primary Key used in our database and can have an appointment book with a scheduled time.

Doctors can Scan the QR and write Symptoms, notes and Prescription in the fields.

Doctor portal justs inserts the data using primary key in the QChain.

Similarly the Chemists can Scan the QR and retrieve Precription and provide medicines, using the primary key.

QRfn was found essential and delivering.

Azure FunctionsAzure Functions is a serverless compute service that enables you to run code on-demand without having to explicitly provision or manage infrastructure.

We can Use Azure Functions to run a script or piece of code in response to a variety of events.

Azure function is easy to imagine as a Lego, a piece which helps build a building or a ship with the elephants.

It can serve as crucial API to all your Stack needs when there isn’t any existing API for the same.

Also this Lego piece can be a Ship alone, Performative and you don’t need to pay till you use it (pay per execution model).

Ohkay now, Let’s get Started for QRfnYou can also use and copy paste the code from github repo as images won’t let you ;p https://github.

com/heyayushh/qrfn1.

Write HTML to Respond with a TemplateRequiring Stuff in <head>QRCode.

js — To make QR coderasterizeHTML — To make a Image out of HTMLAnother place for my <head>.

RIP linkin park.

<body> of the HTMLThe div placeholder will be holding the king of the throne( QR code here ).

Screen is just a container for placeholder.

Also I added A download button which executes a script named download() on click, which will download the file.

Being sexy is something inside, not every <body> has it.

ScriptsQRcode.

jsYou won’t find it in half of bollywood movies.

This generates a QR Code in the HTML tag.

You can read more about QRCode.

js here.

convert HTML to a JS StringAs we are sending client a HTML page from JS we should convert it.

As the html content contains lots of ‘,”,< , the js will give errors of parsing, and either we have to use escape characters or use this code.

Mention the path and filename correctly.

In mac OS/ Linux run the command in the directory same as the HTML Page.

or you can also copy-paste the console output too.

node convertHtmlToString.

js | cat >> var.

txtNow, Save the content of var.

txt/output for later use.

Azure FunctionsRequirementsAzure Portal1.

Create a Function App1 Step — Create an a Azure function App2.

Use in-portal developmentstep — 2 Use in-portal Development3.

Create a HTTP trigger/ Webhook / API functionStep 3 — Create a function4.

It’s the showtime.

Step 4 — Write the code.

CODE ????The code has so much to say, merely 10 lines.

qrSite is the variable with the html code we saved earlier.

genQr(text) function returns a QR of the text passed earlier as an argument(same like my girlfriend).

context.

res is the response body(json) for azure function of a successful request.

Save and run the code either in test section or postman adding the text as mentioned below:https://<yourFunctionApp>.

azurewebsites.

net/api/<yourFunctionName>?text=thanku4ReadingMyBlogLolplsclapand it will respond with a HTML website with a QRcode generator.

There we go, we have king of seven kingdoms, protector of the WiFi password, QRfn.

Learn more about :https://functions.

azure.

com/https://imaginecup.

microsoft.

com/en-us/Events?id=0this is the code to QRfn, May the 4th be with you.

A tip for everyone : Please have breakfast everyday despite your busy life.

.

. More details

Leave a Reply