-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.js
78 lines (63 loc) · 2.5 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
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
//Database Connection
const express = require("express");
const mongoose = require("mongoose");
const bodyParser = require("body-parser");
const cors = require("cors");
const dotenv = require("dotenv");
const app = express();
dotenv.config();
const PORT = process.env.PORT || 8070;
app.use(cors());
app.use(bodyParser.json());
app.use(express.json());
const URL = process.env.MONGODB_URL;
mongoose.connect(URL, {
useCreateIndex: true,
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
});
const connection = mongoose.connection;
connection.once("open", () => {
console.log("Mongo DB connection success!");
});
const driversRouter=require("./routes/drivers.js");
const bookingsRouter = require("./routes/bookings.js");
const assignedDriversRouter = require("./routes/assignedDrivers.js");
const assignedGuidesRouter = require("./routes/assignedGuides.js");
const assignedVehicleRouter = require("./routes/assignedVehicle.js");
const usersRouter = require("./routes/users.js");
const unregUserRouter = require("./routes/unregisteredUsers");
const guidesRouter = require("./routes/guides");
const itinerariesRouter = require("./routes/itineraries");
const bookingmanagemntRouter = require("./routes/bookingmanagement");
const cancelbookingsRouter = require("./routes/cancelbookings");
const complaintsRouter = require("./routes/ComplaintRoute");
const feedbacksRouter = require("./routes/FeedbackRoute");
const hotelRoute =require('./routes/posts');
const employeesRouter=require("./routes/employees.js");
const contactus = require("./routes/ContactusRoute");
const vehiclesRouter = require('./routes/vehicles');
const typesRouter = require('./routes/types');
const { connect } = require("mongodb");
app.use('/vehicles', vehiclesRouter);
app.use('/types', typesRouter);
app.use("/drivers",driversRouter);
app.use("/bookings", bookingsRouter);
app.use("/assignedDrivers", assignedDriversRouter);
app.use("/assignedGuides", assignedGuidesRouter);
app.use("/assignedVehicle", assignedVehicleRouter);
app.use("/users", usersRouter);
app.use("/unregUser", unregUserRouter);
app.use("/guides",guidesRouter);
app.use("/itineraries",itinerariesRouter);
app.use("/bookingmanagement",bookingmanagemntRouter);
app.use("/cancelbookings",cancelbookingsRouter);
app.use("/complaint", complaintsRouter );
app.use(hotelRoute);
app.use("/employees", employeesRouter);
app.use("/feedback", feedbacksRouter);
app.use("/contactus", contactus);
app.listen(PORT, () => {
console.log(`Server is up and running on port number ${PORT}`);
});