-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
754 lines (732 loc) · 26.1 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
const express = require("express");
const app = express();
const cors = require("cors");
require("dotenv").config();
const jwt = require("jsonwebtoken");
const port = process.env.PORT || 3000;
const { MongoClient, ServerApiVersion, ObjectId } = require("mongodb");
// SSL
const SSLCommerzPayment = require("sslcommerz-lts");
const store_id = process.env.STORE_ID;
const store_passwd = process.env.STORE_PASS;
const is_live = false; //true for live, false for sandbox
// Middleware
app.use(cors());
app.use(express.json());
const verifyJWT = (req, res, next) => {
const authorization = req.headers.authorization;
if (!authorization) {
return res
.status(401)
.send({ error: true, message: "unauthorized access" });
}
const token = authorization.split(" ")[1];
jwt.verify(token, process.env.ACCESS_TOKEN_SECRET, (error, decoded) => {
if (error) {
return res
.status(403)
.send({ error: true, message: "unauthorized access" });
}
req.decoded = decoded;
next();
});
};
// Mongo start here
const uri = `mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASS}@cluster0.vlpkg6s.mongodb.net/?retryWrites=true&w=majority`;
// Create a MongoClient with a MongoClientOptions object to set the Stable API version
const client = new MongoClient(uri, {
serverApi: {
version: ServerApiVersion.v1,
strict: true,
deprecationErrors: true,
},
});
async function run() {
try {
// Connect the client to the server (optional starting in v4.7)
await client.connect();
/* Working Zone Start */
// Collections
const db = client.db("jashoreFoodiesDB");
const usersCollection = db.collection("users");
const restaurantsCollection = db.collection("restaurants");
const restaurantFeedbackCollection = db.collection(
"authorityrestaurantfeedback"
);
const adminsCollection = db.collection("admins");
// Restaurant
const itemsCollection = db.collection("fooditems");
const tableCollection = db.collection("restauranttables");
// Reservations
const currentReservationCollection = db.collection("currentreservation");
const reservationHistoryCollection = db.collection("reservationhistory");
// User
const cartCollection = db.collection("carts");
// Payments
const reservationspaymentsCollection = db.collection(
"reservationspayments"
);
const userPaymenthistoryCollection = db.collection("userpaymenthistory");
const restaurantPaymentHistoryCollection = db.collection(
"restaurantpaymenthistory"
);
// order currentfoodorder
const currentOrderCollection = db.collection("currentfoodorder");
const orderHistoryCollection = db.collection("foodorderhistory");
// JWT Token
app.post("/jwt", (req, res) => {
const user = req.body;
const token = jwt.sign(user, process.env.ACCESS_TOKEN_SECRET, {
expiresIn: "1h",
});
res.send({ token });
});
/* Common API*/
app.get("/role/:email", async (req, res) => {
const email = req?.params?.email;
const query = { email: email };
const restaurant = await restaurantsCollection.findOne(query);
const user = await usersCollection.findOne(query);
const admin = await adminsCollection.findOne(query);
const result = {
isCustomer: user?.role === "customer",
isAdmin: admin?.role === "admin",
isRestaurant: restaurant?.role === "restaurant",
};
res.send(result);
});
// Table Reservation Page
app.get("/tablereservation", async (req, res) => {
const result = await tableCollection.find().toArray();
res.send(result);
});
// restaurantdetails
app.get("/restaurantdetails/:email", async (req, res) => {
const email = req.params.email;
const result = await restaurantsCollection.findOne({ email: email });
res.send(result);
});
app.get("/restaurantdetailswi/:restaurantId", async (req, res) => {
const restaurantId = req.params.restaurantId;
const result = await restaurantsCollection.findOne({
_id: new ObjectId(restaurantId),
});
res.send(result);
});
//all items
app.get("/allitems", async (req, res) => {
const result = await itemsCollection.find().toArray();
res.send(result);
});
// all restaurant
app.get("/allrestaurants", async (req, res) => {
const result = await restaurantsCollection.find().toArray();
res.send(result);
});
// Bigg offers
app.get("/offers", async (req, res) => {
const result = await itemsCollection
.find({ offer: { $gt: 0 } })
.toArray();
res.send(result);
});
app.get("/bigoffers", async (req, res) => {
const result = await itemsCollection
.find({ offer: { $gt: 0 } })
.sort({ offer: -1 })
.limit(4)
.toArray();
res.send(result);
});
// New Items
app.get("/newitems", async (req, res) => {
const result = await itemsCollection
.find()
.sort({ date: -1 })
.limit(4)
.toArray();
res.send(result);
});
app.get("/trending", async (req, res) => {
const result = await itemsCollection
.find()
.sort({ sold: -1 })
.limit(4)
.toArray();
res.send(result);
});
/* Customer Related API*/
app.post("/users", async (req, res) => {
const user = req.body;
const query = { email: user.email };
const exists = await usersCollection.findOne(query);
if (exists) {
return res.send({ message: "already exists" });
}
const result = await usersCollection.insertOne(user);
res.send(result);
});
// Table Details for Payment Page
app.get("/tabledetails/:tableId", async (req, res) => {
const tableId = req.params.tableId;
const result = await tableCollection.findOne({
_id: new ObjectId(tableId),
});
res.send(result);
});
// Customer Details for Payment Page
app.get("/customerdetails/:userEmail", async (req, res) => {
const userEmail = req.params.userEmail;
const result = await usersCollection.findOne({ email: userEmail });
res.send(result);
});
// my reservations
app.get("/myreservations/:customerEmail", async (req, res) => {
const customerEmail = req.params.customerEmail;
const result1 = await currentReservationCollection
.find({ customerEmail: customerEmail })
.toArray();
const result2 = await reservationHistoryCollection
.find({ customerEmail: customerEmail })
.toArray();
const result = { result1, result2 };
res.send(result);
});
// my reservations
app.get("/myorders/:customerEmail", async (req, res) => {
const customerEmail = req.params.customerEmail;
const result1 = await currentOrderCollection
.find({ customerEmail: customerEmail })
.toArray();
const result2 = await orderHistoryCollection
.find({ customerEmail: customerEmail })
.toArray();
const result = { result1, result2 };
res.send(result);
});
// payment history
app.get("/userpaymenthistory/:customerEmail", async (req, res) => {
const customerEmail = req.params.customerEmail;
const result = await userPaymenthistoryCollection
.find({ customerEmail: customerEmail })
.toArray();
res.send(result);
});
// Cart
app.post("/carts", async (req, res) => {
const item = req.body;
const result = await cartCollection.insertOne(item);
res.send(result);
});
app.get("/carts/:customerEmail", async (req, res) => {
const customerEmail = req.params.customerEmail;
const result = await cartCollection
.find({ customerEmail: customerEmail })
.toArray();
res.send(result);
});
app.delete("/carts/:id", async (req, res) => {
const id = req.params.id;
const query = { _id: new ObjectId(id) };
const result = await cartCollection.deleteOne(query);
res.send(result);
});
/* Restaurant Related API */
// Restaurant register
app.post("/restaurants", async (req, res) => {
const user = req.body;
const query = { email: user.email };
const exists = await restaurantsCollection.findOne(query);
if (exists) {
return res.send({ message: "already exists" });
}
const result = await restaurantsCollection.insertOne(user);
res.send(result);
});
// check restaurant approval
app.get("/isrestaurantapproved/:email", async (req, res) => {
const email = req?.params?.email;
const query = { email: email };
const restaurant = await restaurantsCollection.findOne(query);
const result = restaurant?.status === "approved";
res.send(result);
});
// Add New Table
app.post("/addtable", async (req, res) => {
const newTable = req.body;
const result = await tableCollection.insertOne(newTable);
res.send(result);
});
// My Tables
app.get("/mytables/:email", async (req, res) => {
const result = await tableCollection
.find({ restaurantEmail: req.params.email })
.toArray();
res.send(result);
});
// My Items
app.get("/myitems/:email", async (req, res) => {
const result = await itemsCollection
.find({ restaurantEmail: req.params.email })
.toArray();
res.send(result);
});
// Add New item
app.post("/additem", async (req, res) => {
const newItem = req.body;
const result = await itemsCollection.insertOne(newItem);
res.send(result);
// console.log(newItem);
});
// delete item
app.delete("/deleteitem/:id", async (req, res) => {
const id = req.params.id;
const result = await itemsCollection.deleteOne({ _id: new ObjectId(id) });
res.send(result);
});
// change availability
app.patch("/updateitemavailable/:id", async (req, res) => {
const result = await itemsCollection.findOne({
_id: new ObjectId(req.params.id),
});
const result2 = await itemsCollection.updateOne(
{ _id: new ObjectId(req.params.id) },
{
$set: {
availability: !result.availability,
},
}
);
res.send(result2);
});
// Cancel reservation
app.delete("/cancelreservation/:id", async (req, res) => {
const id = req.params.id;
const result1 = await currentReservationCollection.findOne({
_id: new ObjectId(id),
});
const result2 = await tableCollection.updateOne(
{ _id: new ObjectId(result1.table._id) },
{
$set: {
availability: true,
},
}
);
const result3 = await currentReservationCollection.deleteOne({
_id: new ObjectId(id),
});
res.send(result3);
});
// tablereservations
app.get("/tablereservations/:restaurantEmail", async (req, res) => {
const restaurantEmail = req.params.restaurantEmail;
const result1 = await currentReservationCollection
.find({ restaurantEmail: restaurantEmail })
.toArray();
const result2 = await reservationHistoryCollection
.find({ restaurantEmail: restaurantEmail })
.toArray();
const result = { result1, result2 };
res.send(result);
});
// currentorders
app.get("/currentorders/:restaurantEmail", async (req, res) => {
const restaurantEmail = req.params.restaurantEmail;
const result = await currentOrderCollection
.find({ restaurantEmail: restaurantEmail })
.toArray();
res.send(result);
});
app.delete("/deliveredorder/:id", async (req, res) => {
const id = req.params.id;
const result1 = await currentOrderCollection.findOne({
_id: new ObjectId(id),
});
result1.deliveryStatus = "delivered";
const result2 = orderHistoryCollection.insertOne(result1);
const result3 = await currentOrderCollection.deleteOne({
_id: new ObjectId(id),
});
res.send(result3);
});
app.delete("/cancelorder/:id", async (req, res) => {
const id = req.params.id;
const result1 = await currentOrderCollection.findOne({
_id: new ObjectId(id),
});
result1.deliveryStatus = "cancelled";
const result2 = orderHistoryCollection.insertOne(result1);
const result3 = await currentOrderCollection.deleteOne({
_id: new ObjectId(id),
});
res.send(result3);
});
// Order History
app.get("/orderhistory/:restaurantEmail", async (req, res) => {
const restaurantEmail = req.params.restaurantEmail;
const result = await orderHistoryCollection
.find({ restaurantEmail: restaurantEmail })
.toArray();
res.send(result);
});
/* Admin Related Api */
app.get("/pendingrestaurnt", async (req, res) => {
const query = { status: "pending" };
const result = await restaurantsCollection.find(query).toArray();
// console.log(result)
res.send(result);
});
app.post("/approverestaurant/:id", async (req, res) => {
const id = req.params.id;
const message = req.body.message;
const newfeedback = { restaurantId: id, message };
const query = { _id: new ObjectId(id) };
const feedback = await restaurantFeedbackCollection.insertOne(
newfeedback
);
const updateDoc = {
$set: {
status: "approved",
},
};
const restaurant = await restaurantsCollection.updateOne(
query,
updateDoc
);
const acknowledged = {
acknowledged: feedback.acknowledged && restaurant.acknowledged,
};
console.log(acknowledged);
res.send(acknowledged);
});
// app.post('/adminfeedback', async(req, res)=>{
// const query = {status: "pending"}
// const result = await restaurantsCollection.find(query).toArray();
// res.send(result)
// })
// Home page info
app.get("/adminhomeinfo", async (req, res) => {
const query = { status: "pending" };
const result = await restaurantsCollection.find(query).toArray();
const info = { newreq: result.length };
res.send(info);
});
/* SSL Commerz */
// For Table Reservations
const tran_id = new ObjectId().toString();
app.post("/reservepayment", async (req, res) => {
// console.log(req.body);
const info = req.body;
const table = info.table;
table.price = parseFloat(table.price);
const customer = info.customer;
const data = {
total_amount: (table?.price * 0.5).toFixed(2),
currency: info.currency,
tran_id: tran_id, // use unique tran_id for each api call
success_url: `http://localhost:3000/reservationpayment/success/${tran_id}`,
fail_url: `http://localhost:3000/reservationpayment/failed/${tran_id}`,
cancel_url: "http://localhost:3030/cancel",
ipn_url: "http://localhost:3030/ipn",
shipping_method: "Courier",
product_name: "Restaurant Table.",
product_category: table.shape,
product_profile: "general",
cus_name: info.name,
cus_email: customer.email,
cus_add1: info.address,
cus_add2: "Dhaka",
cus_city: "Dhaka",
cus_state: "Dhaka",
cus_postcode: info.postcode,
cus_country: "Bangladesh",
cus_phone: info.phone,
cus_fax: "01711111111",
ship_name: "Customer Name",
ship_add1: "Dhaka",
ship_add2: "Dhaka",
ship_city: "Dhaka",
ship_state: "Dhaka",
ship_postcode: 1000,
ship_country: "Bangladesh",
};
// console.log(info)
const newCurrentReservation = {
customerId: customer._id,
customerEmail: customer.email,
customerName: info.name,
customerContact: info.phone,
table,
amount: (table?.price * 0.5).toFixed(2),
restaurantEmail: table.restaurantEmail,
time: new Date(),
};
const newUserPaymentHistory = {
tranId: tran_id,
currency: info.currency,
itemType: "table",
amount: (table?.price * 0.5).toFixed(2),
table,
restaurantEmail: table.restaurantEmail,
customerId: customer._id,
customerEmail: customer.email,
time: new Date(),
};
const newRestaurantPaymentHistory = {
tranId: tran_id,
currency: info.currency,
itemType: "table",
customerEmail: customer.email,
customerId: customer._id,
customerName: info.name,
amount: (table?.price * 0.5).toFixed(2),
table,
restaurantEmail: table.restaurantEmail,
restaurantId: table.restaurantId,
restaurantName: table.restaurantName,
time: new Date(),
};
// console.log(newCurrentReservation)
// console.log(newUserPaymentHistory)
// console.log(newRestaurantPaymentHistory)
const sslcz = new SSLCommerzPayment(store_id, store_passwd, is_live);
sslcz.init(data).then((apiResponse) => {
// Redirect the user to payment gateway
let GatewayPageURL = apiResponse.GatewayPageURL;
// res.redirect(GatewayPageURL)
res.send({ url: GatewayPageURL });
// Transaction Info for user
const paymentInfo = {
paymentStatus: false,
amount: parseFloat(table?.price) * (0.5).toFixed(2),
transactionId: tran_id,
tableId: table._id,
restaurantEmail: table.restaurantEmail,
restaurantName: table.restaurantName,
customerId: customer._id,
customerEmail: customer.email,
customerName: customer.name,
};
const result = reservationspaymentsCollection.insertOne(paymentInfo);
console.log("Redirecting to: ", GatewayPageURL);
});
app.post("/reservationpayment/success/:tranId", async (req, res) => {
// console.log(req.params.tranId);
const result = await reservationspaymentsCollection.updateOne(
{ transactionId: req.params.tranId },
{
$set: {
paymentStatus: true,
},
}
);
if (result.modifiedCount > 0) {
currentReservationCollection.insertOne(newCurrentReservation);
userPaymenthistoryCollection.insertOne(newUserPaymentHistory);
restaurantPaymentHistoryCollection.insertOne(
newRestaurantPaymentHistory
);
reservationHistoryCollection.insertOne(newCurrentReservation);
tableCollection.updateOne(
{ _id: new ObjectId(table._id) },
{
$set: {
availability: false,
},
}
);
res.redirect(
`http://localhost:5173/payment/success/${req.params.tranId}`
);
}
});
app.post("/reservationpayment/failed/:tranId", async (req, res) => {
// console.log(req.params.tranId);
const result = await reservationspaymentsCollection.deleteOne({
transactionId: req.params.tranId,
});
if (result.deletedCount > 0) {
res.redirect(
`http://localhost:5173/payment/failed/${req.params.tranId}`
);
}
});
});
app.post("/foodpayment", async (req, res) => {
const info = req.body;
const items = info.items;
const customer = info.customer;
const data = {
total_amount: info.totalPrice,
currency: info.currency,
tran_id: tran_id, // use unique tran_id for each api call
success_url: `http://localhost:3000/foodpayment/success/${tran_id}`,
fail_url: `http://localhost:3000/foodpayment/failed/${tran_id}`,
cancel_url: "http://localhost:3030/cancel",
ipn_url: "http://localhost:3030/ipn",
shipping_method: "Courier",
product_name: "Food",
product_category: "Random",
product_profile: "general",
cus_name: info.name,
cus_email: customer.email,
cus_add1: info.address,
cus_add2: "Dhaka",
cus_city: "Dhaka",
cus_state: "Dhaka",
cus_postcode: info.postcode,
cus_country: "Bangladesh",
cus_phone: info.phone,
cus_fax: "01711111111",
ship_name: info.name,
ship_add1: "Dhaka",
ship_add2: "Dhaka",
ship_city: "Dhaka",
ship_state: "Dhaka",
ship_postcode: 1000,
ship_country: "Bangladesh",
};
// const newCurrentOrder = {
// customerId: customer._id,
// customerEmail: customer.email,
// customerName: info.name,
// customerContact: info.phone,
// items,
// time: new Date()
// }
// const newRestaurantPaymentHistory = {
// tranId: tran_id,
// currency: info.currency,
// itemType: "food",
// customerEmail: customer.email,
// customerId: customer._id,
// customerName: info.name,
// amount: info.totalPrice,
// items,
// time: new Date()
// }
const sslcz = new SSLCommerzPayment(store_id, store_passwd, is_live);
sslcz.init(data).then((apiResponse) => {
// Redirect the user to payment gateway
let GatewayPageURL = apiResponse.GatewayPageURL;
// res.redirect(GatewayPageURL)
res.send({ url: GatewayPageURL });
// Transaction Info for user
const paymentInfo = {
paymentStatus: false,
amount: info.totalPrice,
transactionId: tran_id,
items,
customerId: customer._id,
customerEmail: customer.email,
customerName: customer.name,
};
const result = reservationspaymentsCollection.insertOne(paymentInfo);
console.log("Redirecting to: ", GatewayPageURL);
});
app.post("/foodpayment/success/:tranId", async (req, res) => {
// console.log(req.params.tranId);
const result = await reservationspaymentsCollection.updateOne(
{ transactionId: req.params.tranId },
{
$set: {
paymentStatus: true,
},
}
);
if (result.modifiedCount > 0) {
items.map((item) => {
const newCurrentOrder = {
customerId: customer._id,
customerEmail: customer.email,
customerName: info.name,
customerContact: info.phone,
item: item.item,
amount:
item.item.price -
((item.item.price * item.item.offer) / 100.0).toFixed(2),
restaurantEmail: item.item.restaurantEmail,
time: new Date(),
instruction: info.instruction,
deliveryStatus: "pending",
};
const newUserPaymentHistory = {
tranId: tran_id,
currency: info.currency,
itemType: "food",
amount:
item.item.price -
((item.item.price * item.item.offer) / 100.0).toFixed(2),
item: item.item,
restaurantEmail: item.item.restaurantEmail,
customerId: customer._id,
customerEmail: customer.email,
time: new Date(),
};
const newRestaurantPaymentHistory = {
tranId: tran_id,
currency: info.currency,
itemType: "food",
customerEmail: customer.email,
customerId: customer._id,
customerName: info.name,
amount:
item.item.price -
((item.item.price * item.item.offer) / 100.0).toFixed(2),
item: item.item,
restaurantEmail: item.item.restaurantEmail,
restaurantName: item.item.restaurantName,
time: new Date(),
};
currentOrderCollection.insertOne(newCurrentOrder);
userPaymenthistoryCollection.insertOne(newUserPaymentHistory);
restaurantPaymentHistoryCollection.insertOne(
newRestaurantPaymentHistory
);
// orderHistoryCollection.insertOne(newCurrentOrder)
itemsCollection.updateOne(
{ _id: new ObjectId(item.item._id) },
{
$set: {
sold: item.item.sold + 1,
},
}
);
});
cartCollection.deleteMany({ customerEmail: customer.email });
res.redirect(
`http://localhost:5173/payment/success/${req.params.tranId}`
);
}
});
app.post("/foodpayment/failed/:tranId", async (req, res) => {
// console.log(req.params.tranId);
const result = await reservationspaymentsCollection.deleteOne({
transactionId: req.params.tranId,
});
if (result.deletedCount > 0) {
res.redirect(
`http://localhost:5173/payment/failed/${req.params.tranId}`
);
}
});
});
/* Working Zone End */
// Send a ping to confirm a successful connection
await client.db("admin").command({ ping: 1 });
console.log(
"Pinged your deployment. You successfully connected to MongoDB!"
);
} finally {
// Ensures that the client will close when you finish/error
/* await client.close(); */
}
}
run().catch(console.dir);
app.get("/", (req, res) => {
res.send("Jashore Foodies is currently running");
});
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});