-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
44 lines (40 loc) · 1.44 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
const express = require("express");
const morgan = require("morgan");
const cors = require("cors");
const mongoose = require("mongoose");
const passport = require("passport");
const fileUpload = require("express-fileupload");
const app = express();
app.use(morgan("dev"));
app.use(cors());
// app.use(bodyParser.urlencoded({ limit: "1024mb", extended: true }));
// app.use(bodyParser.json({ limit: "1024mb", extended: true }));
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(passport.initialize());
require("./passport")(passport);
app.use(fileUpload());
app.use(express.static("images"));
app.use("/api/visitors", require("./routers/visitorRouter"));
app.use("/api/guide", require("./routers/guideRouter"));
app.use("/api/admin", require("./routers/adminRouter"));
app.use("/api/places", require("./routers/placeRouter"));
app.use("/api/reportedPlaces", require("./routers/reportedPlaceRouter"));
app.use("/api/reportedPost", require("./routers/reportedPostRouter"));
app.use("/api/posts", require("./routers/postRouter"));
app.use("/api/forgetPassword", require("./routers/forgetPassword"));
app.get("/", (req, res) => {
res.json({
message: "Welcome to Travelers Hut",
});
});
const PORT = process.env.PORT || 4000;
app.listen(PORT, () => {
mongoose.connect(
"mongodb://localhost/Travelers-Hut",
{ useNewUrlParser: true, useUnifiedTopology: true },
() => {
console.log("database connected");
}
);
});