Below is an example of converting a text to qr code.
var QRCode = require('qrcode');
var express = require('express');
var connect = express();
connect.get('/', function(req, res){
res.writeHead(200, { 'Content-Type': 'text/html' });
var sometext='hi my name is saurav ghadai';
// QRCode.QRCodeDraw.color.dark = '#d4d4d4';
QRCode.toDataURL(sometext, function (err, url) {
if (err) console.log('error: ' + err)
res.end("<!DOCTYPE html/><html><head><title>node-qrcode</title></head><body><img src='" + url + "'/></body></html>");
});
});
connect.listen(3030);
console.log('test server started on port 3030');
like this how can we create qr code for a json object ?
via Sourav Ghadai
No comments:
Post a Comment