Showing
6 changed files
with
40 additions
and
0 deletions
express-mysql/db_option.js
0 → 100644
express-mysql/index.js
0 → 100644
1 | +const mysql = require('mysql'); | ||
2 | +const option = require('./db_option'); | ||
3 | +const connection = mysql.createConnection(option); | ||
4 | + | ||
5 | +connection.connect(); | ||
6 | + | ||
7 | +connection.query('SELECT * FROM Persons', (err, rows, fields) => { | ||
8 | + if (!err) { | ||
9 | + console.log('The solution is :', rows); | ||
10 | + } | ||
11 | + else { | ||
12 | + console.error('error: ', err); | ||
13 | + } | ||
14 | +}); | ||
15 | + | ||
16 | +connection.end(); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
express-mysql/package-lock.json
0 → 100644
This diff is collapsed. Click to expand it.
express-mysql/package.json
0 → 100644
1 | +{ | ||
2 | + "name": "express-mysql", | ||
3 | + "version": "1.0.0", | ||
4 | + "description": "", | ||
5 | + "main": "index.js", | ||
6 | + "scripts": { | ||
7 | + "start": "node index" | ||
8 | + }, | ||
9 | + "keywords": [], | ||
10 | + "author": "", | ||
11 | + "license": "ISC", | ||
12 | + "dependencies": { | ||
13 | + "express": "4.17.0", | ||
14 | + "mysql": "2.17.1" | ||
15 | + } | ||
16 | +} |
This diff could not be displayed because it is too large.
... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
17 | "http-errors": "~1.6.2", | 17 | "http-errors": "~1.6.2", |
18 | "morgan": "~1.9.0", | 18 | "morgan": "~1.9.0", |
19 | "mysql": "^2.16.0", | 19 | "mysql": "^2.16.0", |
20 | + "pm2": "^3.5.0", | ||
20 | "request": "^2.88.0", | 21 | "request": "^2.88.0", |
21 | "socket.io": "^2.1.1" | 22 | "socket.io": "^2.1.1" |
22 | } | 23 | } | ... | ... |
-
Please register or login to post a comment