项目作者: diegodossantos95

项目描述 :
NodeJS Module for accessing destination details on SAP Cloud Platform Cloud Foundry stack
高级语言: JavaScript
项目地址: git://github.com/diegodossantos95/consume-destination-scp-cf.git
创建时间: 2018-12-11T17:23:26Z
项目社区:https://github.com/diegodossantos95/consume-destination-scp-cf

开源协议:MIT License

下载


consume-destination-scp-cf

npm Package
Build Status
Generic badge

NodeJS Module for accessing destination details on SAP Cloud Platform Cloud Foundry stack

Install

  1. npm i consume-destination-scp-cf

Prerequisites

  • Destination service instance created
  • Destination configured
  • All of the above instances bound to the node app, e.g. via manifest.yml:
    1. applications:
    2. - name: my_app
    3. path: my_app
    4. memory: 128M
    5. services:
    6. - destination-instance

Usage

  1. const consumeDestination = require('consume-destination-scp-cf');
  2. // Promise chain
  3. consumeDestination({
  4. url: '/api/json',
  5. destinationInstance: 'my-destination-instance',
  6. destinationName: 'myDestination',
  7. httpMethod: 'POST',
  8. payload: {
  9. "me": "here"
  10. }
  11. })
  12. .then(response => {
  13. // handle response
  14. })
  15. .catch(err => {
  16. // handle error
  17. })

API

consume-destination-scp-cf(options)

  • url = Optional, the url to call in the destination, absolute path (including leading slash) e.g. /api/v1/json
  • destinationInstance = Name of the instance of the destination service
  • destinationName = Name of the destination to use
  • httpMethod = HTTP method to use on Destination. Supported GET, POST, PUT, PATCH, DELETE, HEAD and OPTIONS.
  • payload = Optional, payload for POST, PUT or PATCH

License

MIT

References