-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlab.js
More file actions
58 lines (51 loc) · 1.64 KB
/
lab.js
File metadata and controls
58 lines (51 loc) · 1.64 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
var express = require('express');
// const { query } = require('./database');
// const { response } = require('./app');
var router = express.Router();
var database = require('./database');
router.get("/phy", (req,res) => {
query = `SELECT * FROM phy_1; SELECT * FROM phy_2;`;
database.query(query, (error, rows) => {
if(error) throw error;
// console.log(rows[0].i_id);
// console.log(rows[0].image);
// console.log(rows[0].model);
// console.log(rows[0].quantity);
// console.log(rows[0].desc);
if(!error){
res.render("phy-lab", {data: rows});
}
})
});
router.get("/chem", (req,res) => {
query = `SELECT * FROM chem_1; SELECT * FROM chem_2;`;
database.query(query, (error, rows) => {
if(error) throw error;
// console.log(rows[0].i_id);
// console.log(rows[0].image);
// console.log(rows[0].model);
// console.log(rows[0].quantity);
// console.log(rows[0].desc);
if(!error){
res.render("chem-lab", {data: rows});
}
})
});
router.get("/cs", (req,res) => {
query = `SELECT * FROM cs_1; SELECT * FROM cs_2; SELECT * FROM cs_3;`;
database.query(query, (error, rows) => {
if(error) throw error;
// console.log(rows[0].i_id);
// console.log(rows[0].image);
// console.log(rows[0].model);
// console.log(rows[0].quantity);
// console.log(rows[0].desc);
if(!error){
res.render("cs-lab", {data: rows});
}
})
});
router.get('/', function(req, res, next) {
res.redirect('/');
});
module.exports = router;