Setup of Node.js SDK
The Aspose.BarCode Cloud SDK for Node.js allows you to easily integrate barcode generation and recognition functionality into your .NET applications. This guide will walk you through the setup process using the GitHub repository and NuGet package.
Prerequisites
- Tested on ‘18.x’, ‘20.x’, ‘22.x’, ’lts/*’, ’latest’ Node.js versions
- An Aspose Cloud account. Sign up for free on Aspose.Cloud to obtain your Client Id and Client Secret.
Installing the SDK
You can install the Aspose.BarCode Cloud SDK via NmpmJs:
npm install aspose-barcode-cloud-node --save
Setting Up the Configuration
The Configuration
class is essential for setting up the SDK. It manages your API credentials, base URLs, and other settings.
Basic Configuration
First, import the required namespaces:
const Barcode = require('aspose-barcode-cloud-node');
Then, set up the configuration:
const config = new Barcode.Configuration(
'Client Id from https://dashboard.aspose.cloud/applications',
'Client Secret from https://dashboard.aspose.cloud/applications'
);
This basic setup will use the default values for API base url, token url and other options which are optimized for general use.
Using the SDK
Once configured, pass the configuration object to initialize API clients. Here’s an example:
const generateApi = new Barcode.GenerateApi(config);
const recognizeApi = new Barcode.RecognizeApi(config);
const scanApi = new Barcode.ScanApi(config);
Now you can call SDK functions.
Conclusion
This documentation has provided the necessary steps to configure and initialize the Aspose.BarCode Cloud SDK for Node.js. Refer to the others section of Developer Guide for more detailed usage examples.