-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6483a56
commit f822394
Showing
5 changed files
with
42 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Router } from "express"; | ||
|
||
const errorRouter = Router(); | ||
|
||
|
||
// Error handling | ||
errorRouter.get("*", (req, res) => { | ||
res.json("404: Path could not be found! COULD NOT {GET}"); | ||
res.status(404); | ||
}); | ||
|
||
errorRouter.post("*", (req, res) => { | ||
res.json("404: Path could not be found! COULD NOT {POST}"); | ||
res.status(404); | ||
}); | ||
|
||
errorRouter.put("*", (req, res) => { | ||
res.json("404: Path could not be found! COULD NOT {PUT}"); | ||
res.status(404); | ||
}); | ||
|
||
errorRouter.delete("*", (req, res) => { | ||
res.json("404: Path could not be found! COULD NOT {DELETE}"); | ||
res.status(404); | ||
}); | ||
|
||
export default errorRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { Router } from "express"; | ||
import authRouter from "./auth"; | ||
import userRouter from "./user"; | ||
import errorRouter from "./error/error"; | ||
|
||
const userAndAuthRouter = Router(); | ||
const mainRouter = Router(); | ||
|
||
userAndAuthRouter.use(authRouter); | ||
userAndAuthRouter.use(userRouter); | ||
mainRouter.use(authRouter); | ||
mainRouter.use(userRouter); | ||
mainRouter.use(errorRouter); | ||
|
||
export default userAndAuthRouter; | ||
export default mainRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters