-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from eclipse/readme-core-tools
feat: add readme's for td-tools and core
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "[email protected]" | ||
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/ |