forked from tolson9/4400
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
35 lines (27 loc) · 620 Bytes
/
api.js
File metadata and controls
35 lines (27 loc) · 620 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
27
28
29
30
31
32
33
34
35
var mysql = require('mysql');
var con = mysql.createConnection({
/*host: "academic-mysql.cc.gatech.edu",
user: "cs4400_team_35",
password: "wGEwFeGc",
//database: "cs4400_team_35"*/
host: "127.0.0.1",
user: "root",
password: "root",
database: "testdb"
});
var express = require('express');
var app = express();
app.get('/query', function(request, response){
console.log(request.query.statement);
con.query(request.query.statement, function(err, result) {
if(err){
console.log(err);
throw err;
}
else {
console.log(result);
response.jsonp(result);
}
});
});
app.listen(3000);