contacts.js 485 B

1234567891011121314
  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. router
  10. .get('/:number', guard, controllers.getContactById)
  11. .delete('/:number', guard, controllers.removeContact);
  12. module.exports = router;