-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
26 lines (21 loc) · 619 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
const express = require('express');
const connectDB = require('./database/db');
const app = express();
const dotenv = require("dotenv");
const authRoute = require("./routes/auth");
const cookieParser=require("cookie-parser");
const {errorHandler}=require("./middlewares/error")
dotenv.config();
app.use(express.json());
app.use(cookieParser());
app.use("/api/auth", authRoute);
app.use(errorHandler);
connectDB()
.then(() => {
app.listen(process.env.PORT, () => {
console.log("App is listening");
});
})
.catch((error) => {
console.error("Error connecting to the database:", error);
});