contacts.js 554 B

123456789101112131415
  1. const express = require('express');
  2. const router = express.Router();
  3. const guard = require('../helpers/guard');
  4. const controllers = require('../controllers/contacts');
  5. const validation = require('../validation/contact');
  6. router
  7. .get('/', guard, controllers.listContacts)
  8. .post('/', guard, validation.createContact, controllers.addContact)
  9. .patch('/', guard, validation.updateContact, controllers.updateContact);
  10. router
  11. .get('/:number', guard, controllers.getContactById)
  12. .delete('/:id', guard, controllers.removeContact);
  13. module.exports = router;