cf-connect

1.0.3 • Public • Published

Cloud Foundry NodeJS Client

This package is intended to be installed and used to let users connect to their apps deployed in Cloud Foundry.

Installation

npm i cf-connect

Usage

Login to your PCF Environment

const UsersUAAController = new (require('cf-connect').UsersUAA);

function setEndPoint(req, res, next) {
            UsersUAAController.setEndPoint('https://api.your.pcf.authorization.endpoint');
}

function userPCFLogin(username, password) {
        UsersUAAController.login(username, password)
                    .then((result) => {
                        resolve(result)
                    })
                    .catch((err) => {
                        reject(err)
                    })
}
const AppsController = new (require('cf-connect').Apps);

function setToken(req, res, next) {
            AppsController.setToken(req.pcfAuthResult);
            AppsController.API_URL = req.body.url;
}

// To get certain App details
function getAppDetails(req, res, next) {
            AppsController.getApp(req.query.appGuid)
            .then((result) => {
                    // your logic here
                }).catch((reason) => {
                    // some awesome error handling here
                });
}

Package Sidebar

Install

npm i cf-connect

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

75.7 kB

Total Files

20

Last publish

Collaborators

  • sunit2k24