forked from yvesm001/Film-Nexus-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (26 loc) · 744 Bytes
/
index.js
File metadata and controls
31 lines (26 loc) · 744 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 morgan from "morgan";
import connectDB from "./config/mongoose.config.js";
import * as dotenv from "dotenv";
import cors from "cors";
import movieRouter from "./routes/movie.routes.js";
import userRouter from "./routes/user.routes.js";
import reviewRouter from "./routes/review.routes.js";
dotenv.config();
const app = express();
const logger = morgan("dev");
// MIDDLEWARE:
app.use(
cors()
);
app.use(express.json());
app.use(logger);
app.use("/user", userRouter);
app.use("/movie", movieRouter);
app.use("/review", reviewRouter);
// START THE SERVER:
app.listen(process.env.PORT, () => {
console.clear();
console.log("Server is up and running on port: ", process.env.PORT);
connectDB();
});