This commit is contained in:
newtbot 2023-12-27 16:58:51 +08:00
parent 84e6b42cb7
commit 45747af260
4 changed files with 567 additions and 454 deletions

View File

@ -10,11 +10,9 @@
/* /*
1) generate random data for each sensor 1) generate random data for each sensor
3) send the coap request to the server 2) pass to mqtt broker
*/ */
const { isNumber } = require("../../Web-Server/functions/validateData");
let region = ["central", "north-east", "north", "east", "west"]; let region = ["central", "north-east", "north", "east", "west"];
function generateRandomData() { function generateRandomData() {

19
Sean/modules/mysql.js Normal file
View File

@ -0,0 +1,19 @@
const mysqlConfig = {
host: process.env.host,
user: process.env.user,
password: process.env.password,
database: process.env.database,
timezone: "Z", // Set the timezone to UTC
};
const connection = mysql.createConnection(mysqlConfig);
connection.connect((err) => {
if (err) {
console.error("Error connecting to MySQL:", err);
return;
}
console.log("Connected to MySQL");
});
module.exports = { connection , mysqlConfig };

View File

@ -0,0 +1,13 @@
const transporter = nodemailer.createTransport({
service: 'gmail',
host: 'smtp.gmail.com',
port: 587, // use the appropriate port for your SMTP server
secure: false, // true for 465, false for other ports
auth: {
user: process.env.euser,
pass: process.env.epass
},
});
module.exports = { transporter } ;

File diff suppressed because it is too large Load Diff