This commit is contained in:
newtbot
2024-01-13 02:47:01 +08:00
parent b3f2f4e5f6
commit a7e1a0028e
6 changed files with 47 additions and 36 deletions

View File

@ -3,11 +3,9 @@ const client = require("./modules/mqtt");
const { validateData } = require("./functions/validateData.js");
const { insertData } = require("./functions/database.js");
/*
1) validate data from IoT sensor
2) upload data to database
3) add more routes to api
4) add swagger documentation
5) add middleware for authentication
1) on data received, validate data
2) websocket to another server
*/
// Event handlers
@ -22,6 +20,8 @@ client.on('connect', () => {
if (validateData(data)) {
//upload to db logic here
insertData(data);
//websocket logic here??
}
else {