-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlisting-3.27.js
More file actions
26 lines (22 loc) · 659 Bytes
/
listing-3.27.js
File metadata and controls
26 lines (22 loc) · 659 Bytes
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
"use strict";
const importCsvFile = require('./toolkit/importCsvFile.js');
const exportToMySql = require('./toolkit/exportToMySql.js');
const mysql = require('nodejs-mysql').default;
const config = {
host: "localhost",
port: 5000,
user: "root",
password: "root",
database: "earthquakes",
dateStrings: true,
debug: true,
acquireTimeout: 0,
connectTimeout: 0,
};
const db = mysql.getInstance(config);
importCsvFile("./data/earthquakes.csv")
.then(data => exportToMySql(db, "largest_earthquakes_export", data))
.catch(err => {
console.error("An error occurred.");
console.error(err.stack);
});