-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (22 loc) · 905 Bytes
/
app.js
File metadata and controls
31 lines (22 loc) · 905 Bytes
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
import express from "express";
import {} from "dotenv/config";
import cors from "cors";
import connectDB from "./config/db";
import { errorHandler } from "./middlewear/errorMiddlewear";
import placeRoutes from "./routes/placeRoutes";
import userRoutes from "./routes/userRoutes";
import recommendationRoutes from "./routes/recommendationRoutes";
import societyRoutes from "./routes/societyRoutes";
const port = process.env.PORT || 8080;
connectDB();
const app = express();
app.use(cors()); // allows all origins
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use("/place", placeRoutes);
app.use("/user", userRoutes);
app.use("/recommendation", recommendationRoutes);
app.use("/society", societyRoutes);
app.use(errorHandler);
app.get("/", (req, res) => res.send("Final project"));
app.listen(port, () => console.log(`Server running on http://localhost:${port}`));