ocb - sender is a npm module that handle a NGSI Object for them transportation to FIWARE Orion Context Broker. It makes possible send context information in easy way to the FIWARE Ecosystem.
npm install ocb-sender
ES5
var cb = require('ocb-sender');
ES6
import OCB as cb from ocb-sender;
For the examples we will use the next JSON as headers
var headers = {
'Fiware-Correlator': '3451e5c2-226d-11e6-aaf0-d48564c29d20'
}
But you can use another options,one empty JSON or you can ignore the headers if you don't need them
cb.config(urlContextBroker, headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
Example
cb.config('http://207.249.127.149:1026/v2/', headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
Example
cb.retrieveAPIResources(headers)
.then((result) => console.log(result))
.catch((err) console.log(err))
Example
cb.getEntityType("Device", headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
Example
cb.getEntityTypes(headers)
.then((result) => console.log(result))
.catch((err) => console.log(err))
MIT