overall improve ments

This commit is contained in:
Mats van Reenen
2018-12-17 19:20:06 +01:00
parent 273d455587
commit 3be7d96901
6 changed files with 10 additions and 3 deletions

2
.gitignore vendored
View File

@@ -0,0 +1,2 @@
*/nodem_moduels

2
README.md Normal file
View File

@@ -0,0 +1,2 @@
# MR-IoT
> A server how redirect all action request for home automation IoT devices to the device with a really easy REST API.

View File

@@ -15,9 +15,9 @@ module.exports = function(query){
if(query.hasOwnProperty(query.device.values[i].name)){ if(query.hasOwnProperty(query.device.values[i].name)){
var value = query[query.device.values[i].name] var value = query[query.device.values[i].name]
switch (query.device.value[i].type) { switch (query.device.values[i].type) {
case "number": case "number":
if(value > query.device.value[i].max){ if(value > query.device.values[i].max){
return 3 // ERROR 3: invalid value return 3 // ERROR 3: invalid value
} }
break; break;

View File

@@ -1,4 +1,5 @@
// TODO: get data from a database
devices = { devices = {
simulation: { simulation: {
addr: "localhost:8081", addr: "localhost:8081",

View File

@@ -16,7 +16,6 @@ var server = http.createServer(function (req, res) {
} }
// split dirrectory and query from url // split dirrectory and query from url
// TODO: accept GET and POST.
[dir, queryTmp] = req.url.split(/\?(.+)/) [dir, queryTmp] = req.url.split(/\?(.+)/)
if(!queryTmp){ if(!queryTmp){
queryTmp = req.read(); queryTmp = req.read();

3
setup.sh Normal file
View File

@@ -0,0 +1,3 @@
#/bin/bash
cd etc
npm install