New project structure

New folder structure
Changed to type:module
Moved routes to separate files
This commit is contained in:
2020-07-17 22:07:55 +02:00
parent ad8ed283d2
commit 2abec5017f
28 changed files with 1252 additions and 305 deletions

14
routes/routeCity.js Normal file
View 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;