Skip to content

Instantly share code, notes, and snippets.

@gambinish
Last active June 16, 2021 21:05
Show Gist options
  • Save gambinish/bb342a7ab406127406a599d5c0bf04f7 to your computer and use it in GitHub Desktop.
Save gambinish/bb342a7ab406127406a599d5c0bf04f7 to your computer and use it in GitHub Desktop.
// this is a test gist
class Device {
constructor(ipAddress) {
this.ipAddress = ipAddress;
}
sendStatus() {
const data = { ipAddress: this.ipAddress, deviceStatus: Math.floor(Math.random() * 3) };
fetch(MESSAGE_QUEUE_POST_ENDPOINT, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => {
console.log("Success:", data);
})
.catch((error) => {
console.error("Error:", error);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment