-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
46 lines (30 loc) · 949 Bytes
/
app.js
File metadata and controls
46 lines (30 loc) · 949 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
36
37
38
39
40
41
42
43
44
45
46
const express = require("express");
const adminRoutes = require('./router/admin')
const app = express();
console.log('hello');
console.log('app');
app.use(express.urlencoded({extended: false}));
app.use(express.json());
app.set('view engine', 'ejs');
const mysql = require('mysql');
const connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '5678',
database: 'dbms_project',
multipleStatements: true
});
//connection = mysql.createConnection({multipleStatements: true});
connection.connect(function(err) {
if (err) throw err;
connection.query("SHOW TABLES;Select * from available; select * from sold", function (err, result, fields) {
if (err) throw err;
console.log(result[0]);
console.log(result[1]);
console.log(result[2]);
});
});
app.use(adminRoutes);
app.listen(7000, function() {
console.log("Server started on port 7000");
});