overall improve ments
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -0,0 +1,2 @@
|
||||
|
||||
*/nodem_moduels
|
||||
|
||||
2
README.md
Normal file
2
README.md
Normal 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.
|
||||
@@ -15,9 +15,9 @@ module.exports = function(query){
|
||||
if(query.hasOwnProperty(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":
|
||||
if(value > query.device.value[i].max){
|
||||
if(value > query.device.values[i].max){
|
||||
return 3 // ERROR 3: invalid value
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
// TODO: get data from a database
|
||||
devices = {
|
||||
simulation: {
|
||||
addr: "localhost:8081",
|
||||
|
||||
@@ -16,7 +16,6 @@ var server = http.createServer(function (req, res) {
|
||||
}
|
||||
|
||||
// split dirrectory and query from url
|
||||
// TODO: accept GET and POST.
|
||||
[dir, queryTmp] = req.url.split(/\?(.+)/)
|
||||
if(!queryTmp){
|
||||
queryTmp = req.read();
|
||||
|
||||
Reference in New Issue
Block a user