Back

Version 15

7/27/2023
export async function qr(req: express.Request, res: express.Response) {
const { qrcode } = await import("https://deno.land/x/qrcode/mod.ts");
const base64Image = await qrcode(
req.query.data ?? "https://stevekrouse-qr.express.val.run/",
);
res.send(`<div>
<img src=${base64Image} height="100px" width="100px" />
<input></input>
<script>
let iframe = document.getElementsByTagName("iframe")[0]
let input = document.getElementsByTagName("input")[0]
input.addEventListener('input', function(e){
img.src="/qr?data=" + e.target.value
})
</script>
</div>`);
}
// Forked from @ramkarthik.GenerateQR
Updated: October 23, 2023