var express = require("express"); var app = express(); const post = require('./lib/post') app.get("/heating", async function (req, res, next) { 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 () { console.log("Server running on port 2020"); });