-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (30 loc) · 788 Bytes
/
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
import express from "express";
import dotenv from "dotenv";
import cookieParser from "cookie-parser";
import cors from "cors";
import db from "./config/Database.js";
import routeAuth from "./routes/routeAuth.js";
import routeUser from "./routes/routeUser.js";
import routeTaskStatus from "./routes/routeTaskStatus.js";
const app = express();
dotenv.config();
try {
await db.authenticate();
console.log("Database is connected");
} catch (error) {
console.log(error);
}
app.use(
cors({
credentials: true,
origin: "http://localhost:3000",
})
);
app.use(cookieParser());
app.use(express.json());
app.use(routeAuth);
app.use(routeUser);
app.use(routeTaskStatus);
app.listen(process.env.APP_PORT, () =>
console.log(`Server running at port : ${process.env.APP_PORT}`)
);