cf-connect
v1.0.3
Published
A simple NodeJs library to connect to Pivotal Cloud Foundry apps.
Readme
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-connectUsage
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
});
}