JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q53623F
  • License MIT

A Cloud Foundry Client for Node.js

Package Exports

  • cf-nodejs-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cf-nodejs-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cf-nodejs-client Build Status Dependency Status devDependency Status

NPM

Note: This package is not ready for a production App yet.

This project provides a simple client library to interact with the Cloud Foundry REST API using Node.js. The client provides objects to retrieve information about the following concepts:

  • Apps
  • Routes
  • Spaces
  • Domains
  • Organizations
  • Stacks
  • Jobs

Take a look the Tests cases developed with Mocha & Chai to understand some stuff about Cloud Foundry and the usage of this client.

Applications

Node.js with Express are a great combination to develop Web applications. If you observe the Sinatra market, you will notice that the community goes in that address. This library could be useful for you to develop a Web Application to interact with a Cloud Foundry Instance.

Getting Started

If you need to interact with a Cloud Foundry platform, install the package in your Node.js development:

npm install cf-nodejs-client --save

Once you have installed the package define in a isolated config file the credentials to operate with the platform:

config.json

{
    "endpoint" : "https://api.run.pivotal.io",
    "username" : "xxx",
    "password" : "yyy"
}

With the credentials defined, create a new file to paste this code to authenticate with the platform.

example.js

"use strict";

var config = require('./config.json');//Load CF configuration

var cloudFoundry = require("cf-nodejs-client").CloudFoundry;
cloudFoundry = new cloudFoundry(config.endpoint);

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

cloudFoundry.getInfo().then(function (result) {
    return cloudFoundry.login(result.token_endpoint,config.username,config.password);
}).then(function (result) {
    console.log(result);   
}).catch(function (reason) {
    console.error("Error: " + reason);
});

Save the file and test:

node example.js

Testing

This project has a test suite to ensure the reability of this project. Try to run the test suite:

istanbul cover node_modules/mocha/bin/_mocha -- -R spec

At the moment, the test suite covers the 91.22%

If you have question, create an issue.

Juan Antonio