var url=require("url");
var qr=require("qr-image")
module.exports = function (app) {
	app.get('/api/qc', function(req,res){
	    var params = url.parse(req.url,true);
	    var detailLink = params.query.detailLink;
	    try {
	        var img = qr.image(detailLink,{size :10});
	        console.log(detailLink)
	        res.writeHead(200, {'Content-Type': 'image/png'});
	        img.pipe(res);
	    } catch (e) {
	        res.writeHead(414, {'Content-Type': 'text/html'});
	        res.end('<h1>414 Request-URI Too Large</h1>');
	    }
	});
};
