dbScheme added
This commit is contained in:
parent
22474ebc11
commit
da5ef52bcd
9
dbScheme.js
Normal file
9
dbScheme.js
Normal 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);
|
10
index.js
10
index.js
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user