How to Generate a QR Code in Node.JS

QR codes have become a common staple for advertising, data sharing, and use in mobile applications. Furthermore, with the current climate of social distancing and the need for limited contact, businesses have turned to QR codes to solve the issue of providing customers with important information such as service lists, menus, or maps. This also helps limit paper usage as disposable versions of these documents are no longer necessary. The following API will allow you to instantly generate QR codes for your business, to keep up with modern needs and technologies.

Image for post
Image for post

To use this API, run this command to install the SDK:

npm install cloudmersive-barcodeapi-client --save

Or, you can add this snippet to your package.json:

"dependencies": {
"cloudmersive-barcodeapi-client": "^1.1.2"
}

Then, you can call the function:

var CloudmersiveBarcodeapiClient = require('cloudmersive-barcodeapi-client');
var defaultClient = CloudmersiveBarcodeapiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveBarcodeapiClient.GenerateBarcodeApi();var value = "value_example"; // String | QR code text to convert into the QR code barcodevar callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.generateBarcodeQRCode(value, callback);

Now, you will be able to create and use QR codes for any of your products or services.

The API Key for this function can be retrieved at no cost and with no commitment on the Cloudmersive website. This will give you access to 800 monthly calls across our entire API library.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store