New project structure
New folder structure Changed to type:module Moved routes to separate files
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const mongoose = require("mongoose");
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const dishSchema = mongoose.Schema({
|
||||
_id: mongoose.Types.ObjectId,
|
||||
@@ -39,4 +39,4 @@ const dishSchema = mongoose.Schema({
|
||||
vegetarian: Boolean,
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("Dish", dishSchema);
|
||||
export default mongoose.model("Dish", dishSchema);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const mongoose = require("mongoose");
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const restaurantSchema = mongoose.Schema({
|
||||
_id: mongoose.Types.ObjectId,
|
||||
@@ -24,4 +24,4 @@ const restaurantSchema = mongoose.Schema({
|
||||
dishes: [mongoose.Types.ObjectId],
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("Restaurant", restaurantSchema);
|
||||
export default mongoose.model("Restaurant", restaurantSchema);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const mongoose = require("mongoose");
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const userSchema = mongoose.Schema({
|
||||
_id: mongoose.Types.ObjectId,
|
||||
@@ -18,4 +18,4 @@ const userSchema = mongoose.Schema({
|
||||
subscriptionDue: Date,
|
||||
});
|
||||
|
||||
module.exports = mongoose.model("User", userSchema);
|
||||
export default mongoose.model("User", userSchema);
|
||||
|
||||
Reference in New Issue
Block a user