-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
51 lines (46 loc) · 1.98 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const express = require("express");
const app = express();
const dotenv = require("dotenv");
const mongoose = require("mongoose");
const CategoryRoute = require("./routes/category");
const RestaurantRoute = require("./routes/restaurant");
const FoodRoute = require("./routes/food");
const AuthRoute = require("./routes/auth");
const UserRoute = require("./routes/user");
const AddressRoute = require("./routes/address");
const OrderRoute = require("./routes/order");
const PayoutRoute = require("./routes/payouts");
const DriverRoute = require("./routes/drivers");
const FeedBackRoute = require("./routes/feedback");
const CartRoute = require("./routes/cart");
const RatingRoute = require("./routes/rating");
const { fireBaseConnection } = require("./utils/fbConnect");
const generateOtp = require("./utils/otp_generator");
const { sendVerificationEmail } = require("./utils/driver_verification_email");
const { sendEmail, sendRejectionEmail } = require("./utils/smtp_function");
dotenv.config();
fireBaseConnection();
mongoose
.connect(process.env.MONGOURL)
.then(() => console.log("Foodly Database Connected"))
.catch((err) => console.log(err));
// const otp = generateOtp();
// console.log(otp);
// sendEmail('[email protected]', otp);
sendVerificationEmail("[email protected]", "Test User")
.then(() => console.log("Test email sent"))
.catch((error) => console.log("Test email sending failed: ", error));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use("/", AuthRoute);
app.use("/api/users", UserRoute);
app.use("/api/category", CategoryRoute);
app.use("/api/restaurant", RestaurantRoute);
app.use("/api/foods", FoodRoute);
app.use("/api/address", AddressRoute);
app.use("/api/orders", OrderRoute);
app.use("/api/payouts", PayoutRoute);
app.use("/api/driver", DriverRoute);
app.use("/api/rating", RatingRoute);
app.use("/api/cart", CartRoute);
app.listen(process.env.PORT || 6013, () => console.log(`Foodly Backend is running on ${process.env.PORT}!`));