Skip to content

dantonio-sap/cap-dest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This sample is intended to show how to call a BTP destination from a CAP service.

To interact with the destination service the CAP service needs to:

  • Authenticate against the uaa service oAuth token
  • Use the token to call the destination service to request the destination information (from destinations in either the cf space or in the subaccount destinations)

This sample:

  • Retrieves the destination data manually for custom implementations where the built in OData service logic in CAP cannot be used.
  • Does this at bootstrap time so that it can be used by the service and doesn't have to make the request at the time of a service call
  • Publishes the destinations as an oData service, just to have an easy place to show it, although not sure why you would ever do this in a real app scenario.

Setup for this sample

  • Create UAA and Destination Service instances in the CF space, this mta project assumes they already exist

    • cf-uaa
    • cf-destinations
  • To determine which destinations to retrieve, modify this line in the server.js

const destinationNames = ["languageService", "API_Business_Hub_Sandbox"];
  • To run locally without deploying, create default-env.json in root of project with crednentials and name with environment variables from corresponding service keys

Example:

{
  "VCAP_SERVICES": {
    "xsuaa": [
      {
        "name": "cf-uaa",
        "label": "xsuaa",
        "tags": ["xsuaa"],
        "credentials": {
          <Paste uaa service key data here>
        }
      }
    ],
    "destination": [
      {
        "name": "cf-destinations",
        "label": "destination",
        "tags": ["destination"],
        "credentials": {
          <Paste destination service key data here>
        }
      }
    ]
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published