Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ router.get('/populate', (req, res, next) => {

router.post('/search', async (req, res, next) => {
const query = req.body.query
db.query(`SELECT id, name, price FROM products WHERE name LIKE '%${query}%'`)
db.query(`SELECT id, name, price FROM products WHERE name LIKE ?`, [`%${query}%`])
.then(response => res.send(response[0]))
.catch(error => console.log(error))
})
Expand Down