generated from alphane/template
Adding in flashcard's and decks
This commit is contained in:
+21
-1
@@ -16,7 +16,7 @@ import { logger } from "@/utils/logger"
|
||||
|
||||
import { jwtMiddleware, authorizationMiddleware } from "@/middlewares"
|
||||
|
||||
import { CurrentUserController, UsersController } from "@/controllers"
|
||||
import { CurrentUserController, FlashcardDecksController, FlashcardsController, UsersController } from "@/controllers"
|
||||
|
||||
export const router = Router()
|
||||
|
||||
@@ -42,6 +42,26 @@ router
|
||||
.patch(UsersController.update)
|
||||
.delete(UsersController.destroy)
|
||||
|
||||
router
|
||||
.route("/api/flashcard-decks")
|
||||
.get(FlashcardDecksController.index)
|
||||
.post(FlashcardDecksController.create)
|
||||
router
|
||||
.route("/api/flashcard-decks/:flashcardDeckId")
|
||||
.get(FlashcardDecksController.show)
|
||||
.patch(FlashcardDecksController.update)
|
||||
.delete(FlashcardDecksController.destroy)
|
||||
|
||||
router
|
||||
.route("/api/flashcards")
|
||||
.get(FlashcardsController.index)
|
||||
.post(FlashcardsController.create)
|
||||
router
|
||||
.route("/api/flashcards/:flashcardId")
|
||||
.get(FlashcardsController.show)
|
||||
.patch(FlashcardsController.update)
|
||||
.delete(FlashcardsController.destroy)
|
||||
|
||||
// if no other routes match, return a 404
|
||||
router.use("/api", (req: Request, res: Response) => {
|
||||
return res.status(404).json({ message: "Not Found", url: req.path })
|
||||
|
||||
Reference in New Issue
Block a user