I need to do the following: Create an azure Function that generates a qr code, and show it on the site (with the string you receive)
const QRCode = require('qrcode');
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
if(req.query.text) {
let code;
try {
code = await QRCode.toDataURL(req.query.text);
} catch (err) {
context.log.error('ERROR', err);
throw err;
}
if (code) {
context.res = {
body: code
}
} else {
context.res = {
body: "Error: QR Code rendering error",
status: 400
}
}
} else {
context.res = {
body: "Error: Missing query string text",
status: 400
}
}
}
I'm using node, with the node -qr code library. It's generating the right qr,i'm testing with query, but it's coming like this:
URI is a base64 encoded string that represents a file
I want to include the image directly from the qr, in a custom webpage