1.0.2 • Published 5 years ago
qr-mon v1.0.2
qr-mon
Microservice to create qr data stream in NodeJS with customized design options.
Getting Started
npm install qr-mon --save
var express = require('express');
var app = express();
var qr-mon = require('qr-mon');
app.get('/qr', function(req, res) {
let error = false;
let options = req.query;
let text = req.query.data ? req.query.data : error = true;
if (!error) {
var code = qr-mon.generate(text, options);
res.type('svg');
res.send(code);
} else {
res.status(500);
res.json({ error: 'Needs text to be encoded' });
}
});
app.listen(3000, () => console.log('server started.....'));
HTML
<img src="http://localhost:3000/qr?data=my_data">
Options
margin
Margin to be left around the qr code
Type: Integer
Default : 0
background
Background color the qr code
Type: rgb()
Default : transparent
shape
Shape of points inside the body of the qr code
Default : 0, square
Option | Image |
---|---|
0 | |
1 | |
2 | |
3 |
eye ball
Shape of inner section of the position markers
Default : 0, square
Option | Image |
---|---|
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
rotary |
eye frame
Shape of frame of the position markers
Default : 0, square
Option | Image |
---|---|
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 |
fill
Fill of the qr code
Default : solid
- solid
- linear-horizontal
- linear-vertical
- radial
color
color of the qr code
Default :
solid : black
gradient : rgb(0,0,0), rgb(2,119,189)
- solid - rgb / name of color
- gradient - color1.color2
1. http://localhost:3000/qr?data=my_data&fill=radial&color=red.black
2. http://localhost:3000/qr?data=my_data&fill=radial (default-fill)