Node.js SDK
- This guide will show you the basic methods of the Corlink Node.js SDK. Along with a minimal example of using the Corlink Node.js SDK.
Prerequisites
- Node.js v18 or later
- An API key from a Corlink server. - Need One? Join our Discord and open a ticket.
Installation
First, install the @rubynetwork/corlink-sdk-node
package if you haven't already installed it in your project
NPM
npm install @rubynetwork/corlink-sdk-node
Methods
- Key Definition: A key is a "license key" that is used to verify a user's access to a resource.
Method | Description |
---|---|
createKey | Create a new Key |
deleteKey | Delete a Key |
verifyKey | Verify a Key |
Options
- Options for the
Corlink
class.
Option | Type | Description | Required |
---|---|---|---|
corlinkAPIUrl | string | The URL of the Corlink server. | Yes |
corlinkAPIKey | string | The API key of the Corlink server. | Yes |
Examples
- Minimal example of using Corlink with the Node.js SDK (both CommonJS and ES Modules).
const { Corlink } = require('@rubynetwork/corlink-sdk-node');
//create a new Corlink instance
const corlink = new Corlink({
corlinkAPIUrl: 'https://corlink.example.com',
corlinkAPIKey: 'your-api-key',
});
//use any of the methods here ex: createKey
async function createKey() {
const key = await corlink.createKey();
console.log(key);
}
createKey();
Table of Contents