diff --git a/packages/core/README.md b/packages/core/README.md new file mode 100644 index 000000000..188c08145 --- /dev/null +++ b/packages/core/README.md @@ -0,0 +1,22 @@ +# Core of node-wot + +The `core` of node-wot is the entry point allowing to attach dedicated bindings such as: +* [HTTP](https://github.com/eclipse/thingweb.node-wot/blob/master/packages/binding-http) +* [CoAP](https://github.com/eclipse/thingweb.node-wot/blob/master/packages/binding-coap) +* ... + +or to create user-specific bindings. + +### Prerequisites +* `npm install @node-wot/core` + + +### Examples + +see binding examples such as +* https://github.com/eclipse/thingweb.node-wot/blob/master/packages/binding-http +* https://github.com/eclipse/thingweb.node-wot/blob/master/packages/binding-coap + +### More Details + +see https://github.com/eclipse/thingweb.node-wot/ diff --git a/packages/td-tools/README.md b/packages/td-tools/README.md new file mode 100644 index 000000000..88398af97 --- /dev/null +++ b/packages/td-tools/README.md @@ -0,0 +1,52 @@ +# TD (ThingDescription) tools of node-wot + +## Getting Started + +In the following example it is shown how td-tools of node-wot can be used. + +### Prerequisites +* `npm install @node-wot/td-tools` + +### Example + +The example parses a TD and also serializes yet another newly created TD. + +`node example.js` + +``` +// example.js +TDTools = require("@node-wot/td-tools"); +Thing = require("@node-wot/td-tools").Thing; + + +// parse TD +let tdString = JSON.stringify({ + id : "123", + title: "MyThing" +}); +let dd = TDTools.parseTD(tdString); +console.log("**** PARSED TD ****"); +console.log(dd); +console.log("****"); + + +// init Thing and serialize to TD +let thing = new Thing(); +thing.id = "789"; +thing["@type"] = "Thing"; +thing.support = "foo@example.com" +thing.properties = { + "myProp" : { + type: "integer" + } +} +let tdString2 = TDTools.serializeTD(thing); +console.log("**** SERIALIZED TD ****"); +console.log(tdString2); +console.log("****"); +``` + + +### More Details + +see https://github.com/eclipse/thingweb.node-wot/