qr-mon

Microservice to create qr data stream in NodeJS with customized design options.

Usage no npm install needed!

<script type="module">
  import qrMon from 'https://cdn.skypack.dev/qr-mon';
</script>

README

qr-mon

Microservice to create qr data stream in NodeJS with customized design options.

npm version

                   

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 body shape 0 image
1 body shape 1 image
2 body shape 2 image
3 body shape 3 image

eye ball

Shape of inner section of the position markers

Default : 0, square

Option Image
0 eye ball 0 image
1 eye ball 1 image
2 eye ball 2 image
3 eye ball 3 image
4 eye ball 4 image
5 eye ball 5 image
6 eye ball 6 image
7 eye ball 7 image
8 eye ball 8 image
9 eye ball 8 image
rotary rotary eye ball image

eye frame

Shape of frame of the position markers

Default : 0, square

Option Image
0 eye_frame 0 image
1 eye_frame 1 image
2 eye_frame 2 image
3 eye_frame 3 image
4 eye_frame 4 image
5 eye_frame 5 image
6 eye_frame 6 image
7 eye_frame 7 image
8 eye_frame 8 image
9 eye_frame 9 image

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)