-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (33 loc) · 985 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
35
36
37
38
39
40
41
const express = require("express");
const app = express();
const cors = require("cors");
app.use(cors());
const { APP_PORT } = require("./config");
const connectDB = require("./config/database");
const {
formRoutes,
userRoutes,
workerRoutes,
sectionRoutes,
smartShedRoutes,
supervisorRoutes,
authorityRoutes,
notificationRoutes,
others,
} = require("./routes");
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
connectDB();
app.get("/", (req, res) => res.send("Welcome to SmartShed API"));
app.use("/api/forms", formRoutes);
app.use("/api/auth", userRoutes);
app.use("/api/workers", workerRoutes);
app.use("/api/supervisors", supervisorRoutes);
app.use("/api/authorities", authorityRoutes);
app.use("/api/sections", sectionRoutes);
app.use("/api/create", smartShedRoutes);
app.use("/api/notifications", notificationRoutes);
app.use("/api", others);
app.listen(APP_PORT, () =>
console.log(`Server is running on port ${APP_PORT}`)
);