npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

contabo.js

v1.0.1

Published

node.js interface for contabo.com api

Downloads

2

Readme

What is Contabo.js?

Contabo.js is a node.js interface to the Contabo API. Contabo is a cloud vps/dedicated server provider that offers competitve prices on their vps products. This module allows you to create/destroy/manage all aspects of your vps/object-storage/images etc. Basically, its a full node.js implementation of the Contabo API.

For API Information See: https://api.contabo.com/ For Contabo VPS Info See: https://contabo.com/en/

License TLDR

MIT - Copyright (c) 2022 Dekita ([email protected]) [view license]

API Documentation

https://api.contabo.com/

System Requirements

node.js

Author Information

website | email | github

How To Use This Module In Your Own Projects:

Assuming you already have a node.js project, simply add the module to your project, and view the examples below to get started!

NOTE: The examples below also detail optional, but HIGHLY recommended steps for how to keep your api/login credentials secure.

Install Contabo.js (REQUIRED)

yarn add contabo.js

OR

npm i contabo.js

Install DotEnv (Optional: Recommended)

DotEnv allows us to read .env variable files into the node.js system environment. This allows us to keep credentials safe!

yarn add dotenv

OR

npm i dotenv

Create .env File (Optional: Recommended)

DotEnv files MUST be named .env (include the dot). Add the variables below to your .env file and set the values according to your own details

contabo_client_id=YOUR-CLIENT-ID
contabo_client_secret=YOUR-CLIENT-SECRET
contabo_username=YOUR_CONTABO_LOGINUSERNAME
contabo_password=YOUR_CONTABO_LOGINPASSWORD

Add .env To Your .gitignore (Optional: Recommended)

If you are pushing your code to a git repo, add .env to the file. This ensures your private credentials are not uploaded when you push your repo.

Create Config File (Optional: Recommended)

This example assumes the file name is config.js.

// load dotenv (.env file) variables into process environment
(require('dotenv')).config();

// export custom application config
module.exports = {
    // set credentials from environment variables
    credentials: {
        client_id: process.env.contabo_client_id,
        client_secret: process.env.contabo_client_secret,
        username: process.env.contabo_username,
        password: process.env.contabo_password,        
    }
};

Contabo.js Example Setup (REQUIRED)

// load config module/credentials (detailed above)
const config = require('./config');
// load contabo.js api interface
const ContaboAPI = require('contabo.js');

// basic async function wrapper so we can 'await' api calls
(async()=>{"use strict";
    // shorthand reference to console log:
    const {log} = console;

    // get all api call categories:
    log('\napi categories:..');
    log(ContaboAPI.categories);

    // get list of all functions of 'instances' category:
    log('\ninstance functions:..');
    log(ContaboAPI.instances);

    // set credentials before performing any actual api call:
    // note: listing api call categories and category function 
    // lists (as shown above) does not count as an api call.
    log('\nsetting credentials:..');
    ContaboAPI.setCredentials(config.credentials);

    log('\ngetting instances:..');
    log(await ContaboAPI.retrieveInstancesList());

    log('\ngetting instances by id:..');
    log(await ContaboAPI.retrieveInstance(987654321));
    
    log('\ngetting instances audits:..');
    log(await ContaboAPI.retrieveInstancesAuditsList({
        instanceId: 987654321,
    }));

})();