This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/api/routes/comments.js

24 lines
675 B
JavaScript
Raw Permalink Normal View History

2020-08-03 12:04:07 +02:00
const { Router } = require('express')
const commentsController = require('../controllers/comments')
const isAuth = require('../middlewares/isAuth')
2020-04-06 23:06:21 +02:00
2020-08-03 12:04:07 +02:00
const CommentsRouter = Router()
2020-04-06 23:06:21 +02:00
2020-05-04 17:19:51 +02:00
CommentsRouter.route('/:commentId')
2020-08-03 14:14:45 +02:00
// Modifier un commentaire
2020-08-03 12:04:07 +02:00
.put(isAuth, commentsController.putCommentsById)
2020-08-03 14:14:45 +02:00
// Supprime un commentaire
2020-08-03 12:04:07 +02:00
.delete(isAuth, commentsController.deleteCommentById)
CommentsRouter.route('/:functionId')
2020-04-06 23:06:21 +02:00
2020-08-03 14:14:45 +02:00
// Récupère les commentaires
2020-08-03 12:04:07 +02:00
.get(commentsController.getCommentsByFunctionId)
2020-08-03 14:14:45 +02:00
// Permet à un utilisateur de poster un commentaire sur une fonction
2020-08-03 12:04:07 +02:00
.post(isAuth, commentsController.postCommentsByFunctionId)
2020-04-06 23:06:21 +02:00
2020-08-03 12:04:07 +02:00
module.exports = CommentsRouter