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/tasks.js

24 lines
622 B
JavaScript
Raw Normal View History

2020-08-03 12:04:07 +02:00
const { Router } = require('express')
const tasksController = require('../controllers/tasks')
const isAuth = require('../middlewares/isAuth')
2020-04-23 15:44:39 +02:00
2020-08-03 12:04:07 +02:00
const TasksRouter = Router()
2020-04-23 15:44:39 +02:00
TasksRouter.route('/')
2020-08-03 14:14:45 +02:00
// Récupère les tâches à faire d'un user
2020-08-03 12:04:07 +02:00
.get(isAuth, tasksController.getTasks)
2020-04-23 15:44:39 +02:00
2020-08-03 14:14:45 +02:00
// Poster une nouvelle tâche à faire
2020-08-03 12:04:07 +02:00
.post(isAuth, tasksController.postTask)
2020-04-23 15:44:39 +02:00
TasksRouter.route('/:id')
2020-08-03 14:14:45 +02:00
// Permet de mettre une tâche à faire en isCompleted ou !isCompleted
2020-08-03 12:04:07 +02:00
.put(isAuth, tasksController.putTask)
2020-04-23 15:44:39 +02:00
2020-08-03 14:14:45 +02:00
// Supprimer une tâche à faire
2020-08-03 12:04:07 +02:00
.delete(isAuth, tasksController.deleteTask)
2020-04-23 15:44:39 +02:00
2020-08-03 12:04:07 +02:00
module.exports = TasksRouter