Browse Source

Added a test api

update-deps
Alex Mikhalev 7 years ago
parent
commit
111fc0c85d
  1. 10
      server/index.ts

10
server/index.ts

@ -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…
Cancel
Save