-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (28 loc) · 1.05 KB
/
index.js
File metadata and controls
35 lines (28 loc) · 1.05 KB
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
35
import express from "express";
import cookieParser from "cookie-parser";
//local imports
import { PORT } from "./config/envConfig.js";
import { mongooseConection } from "./database/mongodb.js";
import authRouter from "./routes/auth.route.js";
import subscriptionRouter from "./routes/subscription.route.js";
import userRouter from "./routes/user.routes.js";
import errorMiddleware from "./middleware/error.middleware.js";
import arcjetMiddleware from "./middleware/arcjet.middleware.js";
import workFlow from "./routes/workFlow.route.js";
const app= express();
//middlewars
app.use(express.json());
app.use(cookieParser())
app.use(errorMiddleware);
app.use(arcjetMiddleware)
app.get("/",(req,res)=>{
res.send("hey working on subscription tracker backend api");
});
app.use("/api/v1/auth", authRouter);
app.use("/api/v1/subscription", subscriptionRouter);
app.use("/api/v1/users", userRouter);
app.use("/api/v1/workflows", workFlow)
app.listen(PORT, async()=>{
console.log(`server is listen on the Port:http://localhost:${PORT}`)
await mongooseConection();
})