Class: Config

Config

Singleton class that keep all API settings.
Author:
  • Bruno Morceli - pirofagista@gmail.com
Source:
Example
const CaneedIO = require('node-cannedio');

// you must call the setup method at least once while running the application.
const token = 'MY_API_TOKEN';
const setupError = Canned.config.setup(token);
if (setupError) {
  console.error(setupError);
  process.exit();
}

// start all requests...

Methods

setup(token, languageopt, endpointopt) → {string}

Setup CannedIO configurations.
Parameters:
Name Type Attributes Default Description
token string Access token given by CannedIO API.
language string <optional>
'en' Language used. Allowed inputs: ['en', 'pt'].
endpoint string <optional>
'https://api.canned.io' Endpoint to API.
Source:
Returns:
Return null whether success, otherwise an error message.
Type
string