Update api with current structure

This commit is contained in:
Moe Poi ~ 2021-11-15 17:56:01 +07:00
parent 5003dcd8b2
commit a0e0e6a667

View file

@ -4,14 +4,14 @@ const db = require('../modules/db')
router.get('/getproducts', (req, res) => {
const conn = db.connect();
conn.execute('SELECT * FROM `product`', [], function(err, results) {
conn.execute('SELECT * FROM `products`', [], function(err, results) {
res.json(results);
});
})
router.get('/getproduct', (req, res) => {
const conn = db.connect();
conn.execute('SELECT * FROM `product` WHERE `model` = ?', [req.query.id], function(err, results) {
conn.execute('SELECT * FROM `products` WHERE `ID` = ?', [req.query.id], function(err, results) {
res.json(results);
});
})