Giter Club home page Giter Club logo

node-wot's Introduction

node-wot

Web of Things implementation on Node.js

Build: Build Status

License

W3C Software License

Prerequisites

On Linux, install lerna

npm install -g lerna

On Windows, install the build tools and lerna (CMD shell as administrator)

npm install --global --production windows-build-tools -g lerna 

How to get ready for coding

# Clone the repository
git clone https://github.com/thingweb/node-wot

# Go into the repository
cd node-wot

# install root dependencies (locally installs tools like typescript and lerna)
npm install 

# bootstrap the packages (installs dependencies and links the inter-dependencies)
# Note: This step is automatically done on building or testing
npm run bootstrap

# use tsc to transcompile TS code to JS in dist directory for each package
npm run build

# run test suites of all packets
npm run test 

# (OPTIONAL!) 
# make all packages available on your local machine (as symlinks)
# you can then use each paket in its local version via "npm link" instead of "npm install"
# see also https://docs.npmjs.com/cli/link
sudo npm run link

No time for explanations - I want to start from something running!

Run all the steps above and then run this:

cd examples/scripts
wot-servient


# e.g., Windows CMD shell (Counter Example)
# expose
# node packages\cli\dist\cli.js  examples\scripts\counter.js
# consume
# node packages\cli\dist\cli.js  examples\scripts\counterClient.js

How to use the library

This library implements the WoT Scripting API

You can also see examples/scripts to have a feeling of how to script a Thing.

Protocol Support

  • HTTP ✔️
  • HTTPS ❓ ?fix needed?
  • CoAP ✔️
  • CoAPS ✖️
  • Websocket ✖️

Note: More protocols can be easily added by implementing ProtocolClient, ProtocolClientFactory and ProtocolServer interface.

MediaType Support

  • JSON ✔️
  • plainText ✔️

Note: More mediaTyes can be easily added by implementing ContentCodec interface.

Logging

We used to have a node-wot-logger package to allow fine-grained logging (by means of Winston). It turned out though that depending on the actual use-case other logging libraries might be better suited. Hence we do not want to prescribe which logging library to use. Having said that, we use console statements which can be easily overriden to use the prefered logging library if needed (see here).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.