node-scalingo
v0.3.0
Published
Node client for Scalingo API
Downloads
2
Readme
node-scalingo
This library is an out-of-the-box HTTP client for the Scalingo API in Node.js.
You can find the detailed Scalingo API specifications on the official API documentation website.
Getting started
1/ Get the following information from Scalingo:
- api_token: from your account or the Scalingo CLI, generate or get your Scalingo API token
- api_endpoint: from the API documentation site, get your targeted region endpoint:
- Agora: https://api.agora-fr1.scalingo.com/v1
- Outscale: https://api.osc-fr1.scalingo.com/v1
2/ Install the dependency
npm install node-scalingo --save
3/ In your code, define a new ScalingoApi
object. Then use the services you need.
const { ScalingoApi } = require('node-scalingo');
const API_TOKEN = '<your_api_token>'; // Enter your own API token
const API_ENDPOINT = 'https://api.osc-fr1.scalingo.com/v1'; // ex: for Outscale region
const scalingoApi = new ScalingoApi(API_TOKEN, API_ENDPOINT);
scalingoApi.apps.listApplications().then(console.log);
Usage
It is recommended to consume services through ScalingoApi
.
If you miss a service - this library is still in construction (feb. 2020) -, you can still use ScalingoClient
and the query()
method, according to the Scalingo developers documentation.
The following example do the same as previously, but with ScalingoClient
instead of ScalingoApi
.
const { ScalingoClient } = require('node-scalingo');
const API_TOKEN = '<your_api_token>'; // Enter your own API token
const API_ENDPOINT = 'https://api.osc-fr1.scalingo.com/v1'; // ex: for Outscale region
const scalingoClient = new ScalingoClient(API_TOKEN, API_ENDPOINT);
scalingoClient.query('apps', 'get').then((response) => console.log(response.data));
Documentation
Please refer to the Scalingo API guides for help using node-scalingo
.
Contributing
Installation
git clone [email protected]:jbuget/node-scalingo.git
cd node-scalingo
npm install
npm run build
npm test
Publishing
npm run release
License
This project is licensed under the AGPL-3.0 License.