error log

This commit is contained in:
2020-10-08 14:30:53 +02:00
parent 023e180337
commit 34c14e03bf

View File

@@ -7,7 +7,7 @@ var router = express.Router();
// SEARCH RESTAURANTS BY NAME OR CITY // SEARCH RESTAURANTS BY NAME OR CITY
router.get("/", (req, res) => { router.get("/", async (req, res) => {
if (req.query.string.length > 0) { if (req.query.string.length > 0) {
const query = sanitizer.sanitize.keepUnicode(decodeURI(req.query.string)); const query = sanitizer.sanitize.keepUnicode(decodeURI(req.query.string));
const regex = new RegExp(query, "i"); const regex = new RegExp(query, "i");
@@ -23,6 +23,7 @@ router.get("/", (req, res) => {
"_id name city imgUrl workingHours description tags location links", "_id name city imgUrl workingHours description tags location links",
(err, results) => { (err, results) => {
if (err) { if (err) {
console.log(err);
res.sendStatus(500); res.sendStatus(500);
} else { } else {
res.send(results); res.send(results);