Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

heroku-client

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heroku-client

A wrapper for the Heroku v3 API

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42K
decreased by-51.27%
Maintainers
1
Weekly downloads
 
Created
Source

node-heroku Build Status

A wrapper around the v3 Heroku API.

Usage

// Create a new client and give it an API token
var Heroku = require('heroku-client').Heroku;
heroku = new Heroku({ token: user.apiToken });

heroku.apps().list(function (err, apps) {
  console.log(apps);
});

heroku.apps('my-app').info(function (err, app) {
  console.log(app);
});

heroku.apps().create({ name: 'my-new-app' }, function (err, app) {
  console.log(app);
});

var newPlan = { plan: { name: 'papertrail:fixa' } };
heroku.apps('my-app').addons('papertrail').update(newPlan, function (err, addon) {
  console.log(addon);
});

Promises

node-heroku works with Node-style callbacks, but also implements promises with the q library.

var q = require('q');

// Fetches dynos for all of my apps.
heroku.apps().list().then(function (apps) {

  return q.all(apps.map(function (app) {
    return heroku.apps(app.name).dynos().list();
  }));

}).then(function (dynos) {

  console.log(dynos);

});

Caching

When NODE_ENV is set to "production", node-heroku will create a memcached client using memjs. See the memjs repo for configuration instructions.

For local development with caching, it's enough to start a memcached server and set MEMCACHIER_SERVERS to 0.0.0.0:11211 in your .env file.

You will also need to pass an option called cacheKeyPostfix when creating your node-heroku client:

var heroku = new Heroku({ token: user.apiToken, cacheKeyPostfix: user.id });

This ensures that API responses are cached and properly scoped to the user that node-heroku is making requests on behalf of.

Contributing

Running tests

node-heroku uses jasmine-node for tests:

$ npm test

Keywords

FAQs

Package last updated on 16 Aug 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc