contacts.js 624 B

12345678910111213141516
  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. .patch('/pin/', guard, validation.updatePin, controllers.pinContact);
  11. router
  12. .get('/:number', guard, controllers.getContactById)
  13. .delete('/:id', guard, controllers.removeContact);
  14. module.exports = router;