dbScheme added

This commit is contained in:
Dawid Kubicki 2019-01-12 10:40:32 +01:00
parent 22474ebc11
commit da5ef52bcd
2 changed files with 14 additions and 5 deletions

9
dbScheme.js Normal file
View File

@ -0,0 +1,9 @@
const mongoose = require("mongoose");
const dbSchema = new mongoose.Schema(
{
name: String,
status: String
},
{ timestamps: true }
);
module.exports = mongoose.model("dbSchema", dbSchema);

View File

@ -16,11 +16,11 @@ let interval = setInterval(() => {
(async url => {
const value_data = await getScript(url);
console.log(value_data);
// const item = new dbSchema({
// name: value_data.split(",")[0],
// value: value_data.split(",")[1]
// });
// await item.save();
const item = new dbSchema({
name: value_data.Sensors[0].TaskName,
status: value_data.Sensors[0].Switch
});
await item.save();
})("http://localhost:3000/chillroom-server?ip=192.168.8.107");
}, 5000);