added database connection

This commit is contained in:
Fabian 2024-11-18 09:06:34 +01:00
parent ac206cd94f
commit 937329c9a4
3 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
const mysql = require('mysql');
const connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "root",
database: "webshop"
});
connection.connect(function (err) {
if (err) throw err;
console.log("Connected to database");
connection.query("SELECT * FROM users", function (err, result) {
if (err) throw err;
console.log(result);
})
});