This package is intended to be installed and used to let users connect to their apps deployed in Cloud Foundry.
npm i cf-connect
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
});
}