@UserTrue said in Node JS with google trends API:
@hippyzipp9
const mysql = require('mysql2');
// create the connection to database
const connection = mysql.createConnection({
host: 'localhost',
user: 'root',
database: 'db',
password: ''
});
await(new Promise((resolve, reject) => {
/*Place your code here and call resolve to proceed*/
connection.connect(function (err) {
if (err) {
reject('error: ' + err.message);
}
console.log('Connected to the MySQL server.');
resolve()
});
}));
Thanks, your solution worked.