import express from "npm:express" import mqtt from "npm:mqtt" const app = express() const client = mqtt.connect("mqtt://localhost") var temp = { "min": { "temp": 100, "place": "" }, "max": { "temp": 0, "place": '' } } app.get("/temp", (req, res) => { res.status(200).send({ "min": { "temp": 12, "place": "Salon" }, "max": { "temp": 50, "place": 'Four' } }) }) client.on("message", (topic, message) => { console.log(topic, message.toString()) if (topic == "temp") { console.log(message.split(":")) } }) app.listen(3000)