split files
This commit is contained in:
parent
ab80e634d3
commit
20631f0440
@ -6,4 +6,17 @@ module.exports = function(app){
|
|||||||
const heating = response.updateData.zones[0]
|
const heating = response.updateData.zones[0]
|
||||||
res.json(heating)
|
res.json(heating)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get("/heating/status", async function (req, res, next) {
|
||||||
|
const response = await post.postRequest()
|
||||||
|
const heating = response.updateData.zones[0].status
|
||||||
|
res.json(heating)
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/heating/config", async function (req, res, next) {
|
||||||
|
const response = await post.postRequest()
|
||||||
|
const heating = response.updateData.zones[0].config
|
||||||
|
res.json(heating)
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
22
routes/water.js
Normal file
22
routes/water.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const post = require('../lib/post')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.get("/water", async function (req, res, next) {
|
||||||
|
const response = await post.postRequest()
|
||||||
|
const water = response.updateData.zones[1]
|
||||||
|
res.json(water)
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/water/status", async function (req, res, next) {
|
||||||
|
const response = await post.postRequest()
|
||||||
|
const water = response.updateData.zones[1].status
|
||||||
|
res.json(water)
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/water/config", async function (req, res, next) {
|
||||||
|
const response = await post.postRequest()
|
||||||
|
const water = response.updateData.zones[1].config
|
||||||
|
res.json(water)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
39
server.js
39
server.js
@ -1,45 +1,8 @@
|
|||||||
var express = require("express");
|
var express = require("express");
|
||||||
var app = express();
|
var app = express();
|
||||||
const post = require('./lib/post')
|
|
||||||
|
|
||||||
app.get("/heating", async function (req, res, next) {
|
require('./routes')(app);
|
||||||
const response = await post.postRequest()
|
|
||||||
const heating = response.updateData.zones[0]
|
|
||||||
res.json(heating)
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get("/heating/status", async function (req, res, next) {
|
|
||||||
const response = await post.postRequest()
|
|
||||||
const heating = response.updateData.zones[0].status
|
|
||||||
res.json(heating)
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get("/heating/config", async function (req, res, next) {
|
|
||||||
const response = await post.postRequest()
|
|
||||||
const heating = response.updateData.zones[0].config
|
|
||||||
res.json(heating)
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get("/water", async function (req, res, next) {
|
|
||||||
const response = await post.postRequest()
|
|
||||||
const water = response.updateData.zones[1]
|
|
||||||
res.json(water)
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get("/water/status", async function (req, res, next) {
|
|
||||||
const response = await post.postRequest()
|
|
||||||
const water = response.updateData.zones[1].status
|
|
||||||
res.json(water)
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get("/water/config", async function (req, res, next) {
|
|
||||||
const response = await post.postRequest()
|
|
||||||
const water = response.updateData.zones[1].config
|
|
||||||
res.json(water)
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(2020, function () {
|
app.listen(2020, function () {
|
||||||
|
|
||||||
|
|
||||||
console.log("Server running on port 2020");
|
console.log("Server running on port 2020");
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user