Skip to content

Commit d98dcdf

Browse files
committed
Adding test points from mysql in need of future development
1 parent 084bd8a commit d98dcdf

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"host": "localhost",
3+
"user": "maps",
4+
"password": "maps",
5+
"database": "maps"
6+
}

index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
const mysql = require('mysql');
22
const express = require('express');
3+
const config = require('./config.json');
34
const app = express();
45

6+
const con = mysql.createConnection(config);
7+
8+
con.connect(function(err) {
9+
if (err) throw err;
10+
con.query("SELECT * FROM points", function (err, result, fields) {
11+
if (err) throw err;
12+
console.log(result);
13+
app.get('/points', function (req, res) {
14+
res.send(result)
15+
})
16+
});
17+
});
18+
519
app.use(express.static('public'));
620

721
app.listen(3000, function () {

0 commit comments

Comments
 (0)