New project structure
New folder structure Changed to type:module Moved routes to separate files
This commit is contained in:
14
routes/routeCity.js
Normal file
14
routes/routeCity.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import express from "express";
|
||||
import Restaurant from "../models/restaurant.js";
|
||||
|
||||
var router = express.Router();
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
Restaurant.find({ city: req.body.city }, (err, data) => {
|
||||
if (err) {
|
||||
res.sendStatus(404);
|
||||
} else res.send(data);
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user