The Webapp codenamed - Kiwano is a system component, part of the Creator IoT
Workshop 4 - Temperature Logger.
The application developed in Node.js is hosted in
Heroku, a Platform as a Service (Paas). The application
uses a MongoDB database, hosted in the cloud - mLab,
therefore providing data cloud storage.
Kiwano is a middle tier Webapp, which consumes the Device Server REST API and it's
resources, fetching for connected devices (AwLWM2M clients) and it's temperature values.
Finally the Webapp provides a RESTAPI to consume the DataBase, in Project 4 it's
used an Android Mobile App, but another REST client could also be used.
There are two ways to use the Webapp:
The application, uses a jwt access token (x-access-token). You can encode your secret using - JWT Builder.
Note: Change the name of template_config.js to config.js.
This guide exaplains the process of cloud deploying the Webapp in Heroku and mLab, using their free tiers. However the performance can be improved using a payed service, or if you prefer different hosting services: AWS, Google Cloud, etc.
mongodb://<dbuser>:<dbpassword>@<dbuser>.mlab.com:<port>/<db_name>
(it will be used in step 4.6). $ heroku login
$ heroku create
$ heroku config:set MONGOLAB_URI=your_db_uri
$ git add .
$ git commit -m "First commit"
$ git push heroku master
$ npm install
$ npm start
HTTP Method | URL Path | Description | Example |
---|---|---|---|
GET | / | Retrieves REST API links | http://localhost:3000/api/v1/ |
GET | /clients | Retrieves all clients list | http://localhost:3000/api/v1/clients |
GET, PUT | /clients/{ID} | Retrieves and manages specific client information | http://localhost:3000/api/v1/clients/123 |
GET | /clients/{ID}/data | Retrieves specific client data | http://localhost:3000/api/v1/clients/123/data |
GET, PUT | /clients/{ID}/delta | Retrieves and manages specific client delta | http://localhost:3000/api/v1/clients/123/delta |
DELETE | /dropdb | Deletes measurements | http://localhost:3000/api/v1/dropdb |
POST | /notification | Receives notifications from the DS | http://localhost:3000/api/v1/notification |
You can generate documentation using APIDOCS. Install and execute:
$ npm install apidoc -g
$ apidoc -i ./api_v1
If you have any problems installing or utilising this project, please look into our Creator Forum.
Otherwise, If you have come across a nasty bug or would like to suggest new features to be added then please go ahead and open an issue or a pull request against this repo.
Please see the license file for a detailed explanation.
Any Bug fixes and/or feature enhancements are welcome. Please see the contributing file for a detailed explanation.