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
667 B
JavaScript
Raw 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 12:04:07 +02:00
// Modifier un commentaire
.put(isAuth, commentsController.putCommentsById)
2020-08-03 12:04:07 +02:00
// Supprime un commentaire
.delete(isAuth, commentsController.deleteCommentById)
CommentsRouter.route('/:functionId')
2020-04-06 23:06:21 +02:00
2020-08-03 12:04:07 +02:00
// Récupère les commentaires
.get(commentsController.getCommentsByFunctionId)
2020-08-03 12:04:07 +02:00
// Permet à un utilisateur de poster un commentaire sur une fonction
.post(isAuth, commentsController.postCommentsByFunctionId)
2020-04-06 23:06:21 +02:00
2020-08-03 12:04:07 +02:00
module.exports = CommentsRouter