45 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-05-07 20:28:30 +01:00
var express = require("express");
var app = express();
2020-05-07 21:55:32 +01:00
const post = require('./lib/post')
2020-05-07 20:28:30 +01:00
2020-05-07 21:55:32 +01:00
app.get("/heating", async function (req, res, next) {
const response = await post.postRequest()
const heating = response.updateData.zones[0]
res.json(heating)
2020-05-07 20:28:30 +01:00
});
2020-05-07 21:55:32 +01:00
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 () {
2020-05-07 20:28:30 +01:00
console.log("Server running on port 2020");
});