-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
31 lines (26 loc) · 752 Bytes
/
Copy pathindex.ts
File metadata and controls
31 lines (26 loc) · 752 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 cors from "cors";
import cp from "cookie-parser";
import "dotenv/config";
import authRouter from "./routes/authRoutes";
import userRouter from "./routes/userRoutes";
import taskRouter from "./routes/taskRoutes";
const app = express();
const PORT = 5000;
app.use(cors({ credentials: true, origin: "http://localhost:3000" }));
app.use(express.json());
app.use(cp());
app.use("/api", authRouter);
app.use("/api", userRouter);
app.use("/api", taskRouter);
const start = async () => {
if (!process.env.DATABASE_USER) {
console.error(
"No .env file or database credentials are not included in it"
);
}
app.listen(PORT);
};
start().then(() => {
console.log("Server started on port", PORT);
});