Spaces:
Sleeping
Sleeping
Commit
·
8a36cc5
1
Parent(s):
014ff66
refactor: more small refactors
Browse files- src/index.route.ts +1 -6
src/index.route.ts
CHANGED
@@ -8,16 +8,11 @@ const mainRouter = express.Router();
|
|
8 |
mainRouter.use("/user", userRoutes);
|
9 |
mainRouter.use("/admin", adminRoutes);
|
10 |
|
11 |
-
mainRouter.get("/", (_req: any, res: any) => {
|
12 |
-
res
|
13 |
-
.status(200)
|
14 |
-
.json({ success: true, message: "Welcome Message", code: 200 });
|
15 |
-
});
|
16 |
-
|
17 |
mainRouter.get("/health", (_req: any, res: any) => {
|
18 |
res.status(200).json({ success: true, message: "Server is up!", code: 200 });
|
19 |
});
|
20 |
|
|
|
21 |
mainRouter.all("*", (_req: any, res: any) => {
|
22 |
res.status(404).json({ success: false, message: "Invalid URL!", code: 404 });
|
23 |
});
|
|
|
8 |
mainRouter.use("/user", userRoutes);
|
9 |
mainRouter.use("/admin", adminRoutes);
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
mainRouter.get("/health", (_req: any, res: any) => {
|
12 |
res.status(200).json({ success: true, message: "Server is up!", code: 200 });
|
13 |
});
|
14 |
|
15 |
+
// catch non existing routes
|
16 |
mainRouter.all("*", (_req: any, res: any) => {
|
17 |
res.status(404).json({ success: false, message: "Invalid URL!", code: 404 });
|
18 |
});
|