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

20 lines
622 B
JavaScript
Raw Normal View History

2020-04-06 23:06:21 +02:00
const { Router } = require('express');
const commentsController = require('../controllers/comments');
const isAuth = require('../middlewares/isAuth');
2020-04-06 23:06:21 +02:00
const CommentsRouter = Router();
CommentsRouter.route('/')
// Supprime un commentaire
.delete(isAuth, commentsController.deleteCommentById);
CommentsRouter.route('/:functionId')
2020-04-06 23:06:21 +02:00
// Récupère les commentaires
.get(commentsController.getCommentsByFunctionId)
// Permet à un utilisateur de poster un commentaire sur une fonction
.post(isAuth, commentsController.postCommentsByFunctionId);
2020-04-06 23:06:21 +02:00
module.exports = CommentsRouter;