0.1.4 • Published 11 years ago
heroku-legacy v0.1.4
node-heroku-api
Port of heroku-api gem to NodeJS.
Installation
$ npm install heroku-legacyUsage
The API is exactly the same, with the following differences:
- All the methods take a callback of the following form:
function (err, body)whereerris one of the error defined insrc/errors.coffeeif any, ornullotherwise andbodyis the JSON response. - All the methods are camelCased.
- When using the
username/passwordconstructor, the object should be used in the callback, and not as the return value.
Here is a short example (in CoffeeScript).
With username/password:
HerokuApi = require 'heroku-legacy'
new HerokuApi username: 'test@foo.jp', password: 'password', (err, api) ->
return handleError(err) unless err == null
api.getApps (err, apps) ->
return handleError unless err == null
console.log appsWith API key:
HerokuApi = require 'heroku-legacy'
api = new HerokuApi apiKey: 'my-api-key'
api.getApps (err, apps) ->
return handleError(err) unless err == null
console.log apps