Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

screencom/transip-nodejs

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TransIP REST API for Node.js

This repository contains the open source Node.js client for the TransIP REST API v6.1.

Software License npm version

Requirements

Installation

npm install transip-nodejs

Usage

We have put some self-explanatory examples in the examples directory, but here is a quick breakdown on how it works. Let's go ahead and initialize the library first. Don't forget to add your private key to private_key.txt and replace <YOUR_USERNAME> with your own username.

CommonJS require syntax:

var fs = require('fs');

const login = '<YOUR_USERNAME>';
const label = 'accesstoken1';

const privateKey = fs.readFileSync('./private_key.txt').toString()

var transip = require('transip-nodejs')(privateKey);

var params = {
  login: login,
  label: label,
  read_only: false,
  experation_time: '30 minutes',
  global_key: false
};

transip.accesstoken.create(params, function(err,response) {
  if (err) {
    return console.log(err);
  }

  if (response.error) {
    return console.log(response);
  }
  else {
    const token = response.token;

    transip.domains.list(token, function(err,response) {
      if (err) {
        return console.log(err);
      }
      else {
        console.log(response);
      }
    });
  }
});

About

nodejs library to interact with TransIP API v6

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.