Heroku.js
The Node.js implementation of the Heroku API. Initially a port of
Heroku.rb, Heroku.jar
and Heroku.py, but with some Javascript-isms and some
aliases added for convention and convenience.
Installation
1 Install via npm
npm install heroku.js
Usage
Begin by instantiating with credentials. You can use an application API Key,
a user email address and API Token, or a username and password. The latter will
fetch an API Key first, so it is an asynchronous request. It will require a callback.
If you pass nothing, it will attempt to read process.env['HEROKU_API_KEY']
var api = new HerokuAPI();
var api = new HerokuAPI({"apiKey" : apiKey});
var api = new HerokuAPI({"email" : email, "apiToken" : apiToken});
new HerokuAPI({ "username" : username, "password" : password }, function(api) {
});
Create an application on the cedar stack
var api = new HerokuAPI(apiKey);
var app = api.postApp({
"stack" : "Cedar",
"name" : "MyApp"
});
List applications
var api = new HerokuAPI(apiKey);
var apps = api.getApps();
for (var i=0; l=apps.length; i < l; i++) {
console.log(app.name);
}
Add Config
var api = new HerokuAPI(apiKey);
api.putConfigVars("myExistingApp", { "SOME_KEY" : "SOMEVALUE" });
Get Config
var api = new HerokuAPI(apiKey);
var config = api.getConfigVars("myExistingApp");
console.log(config);
Remove Config
var api = new HerokuAPI(apiKey);
api.deleteConfigVar("myExistingApp", "SOME_KEY");
Building Locally
1 Clone the repository
git clone https://github.com/dncrews/heroku.js.git
2 Run the testing suite (eventual - This is currently non-functional).
npm test
- Todo
- Different Error Handling
- Unauthorized
- Verification Required
- Forbidden
- Not Found
- Timeout
- Locked
- Rate Limit Exceeded
- Request Failed
- Nil App
- Mock API
- This one is HUGE. It's to make my tests actually work