Greetings!I'm attempting to create a search query, but something's going wrong and I can't figure out what.I'm trying to pass a URL, like:http://localhost:3000/xyz?search=BenefitsThe Express route and SQL query:// Search for positions containing a term app.get("/xyz", (req, res) => { let sql = `SELECT * FROM positions_main WHERE title LIKE ?`; con.query(sql, ["%" + req.query.search + "%"], (err, result) => { if (err) { return res.send(err); } else { return res.json(result); } }); }); I keep getting this error:Failed to load resource: the server responded with a status of 404 (Not Found)What am I doing wrong?Thanks in advance!
Submitted September 22, 2020 at 11:06AM by PalmettoSpur
No comments:
Post a Comment