Added a test api
This commit is contained in:
parent
36458e50ec
commit
111fc0c85d
@ -11,15 +11,13 @@ const mqttClient = new mqtt.MqttApiClient("mqtt://localhost:1883");
|
|||||||
|
|
||||||
mqttClient.start();
|
mqttClient.start();
|
||||||
|
|
||||||
|
import * as sjson from "@common/sprinklers/json";
|
||||||
import { autorun } from "mobx";
|
import { autorun } from "mobx";
|
||||||
const device = mqttClient.getDevice("grinklers");
|
const device = mqttClient.getDevice("grinklers");
|
||||||
autorun(() => log.info("device: ", device.toString()));
|
|
||||||
|
|
||||||
import * as json from "@common/sprinklers/json";
|
app.get("/api/grinklers", (req, res) => {
|
||||||
|
const j = sjson.sprinklersDeviceToJSON(device);
|
||||||
app.get("/grinklers", (req, res) => {
|
log.trace(j);
|
||||||
const j = json.sprinklersDeviceToJSON(device);
|
|
||||||
console.dir(device);
|
|
||||||
res.send(j);
|
res.send(j);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user