-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
44 lines (35 loc) · 1.09 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//"NOT_SUPPORTED_AUTH_MODE" -> create new user auth mech -> 'mysql_native_password'
// mysql -u root -p password
//CREATE USER 'newuser'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'newpassword';
//GRANT ALL PRIVILAGES ON *.* TO 'newuser'@'localhost';
//FLUSH PRIVILAGES;
//mysql
const express = require("express");
const mysql = require("mysql");
const app = express();
const connection = mysql.createConnection({
host: "localhost",
user: "user",
password: "password",
database: "database",
});
connection.connect((err) => {
if (err) throw err;
console.log("connected to MySQL Server");
});
app.get("/", (req, res) => {
connection.query("SELECT * from people", (err, rows) => {
if (err) throw err;
console.log("The data: \n", rows);
connection.end();
});
});
//https://www.youtube.com/watch?v=qwfE7fSVaZM
// task
// frontend
// add employee ->form{emp num, name,department,basic salary}+create -> list entries{employee with edit+delete}
// edit -> form{...emp num not editable}
// delete -> delete list entry
// backend
// mysql db with employees
//hooks + redux