Advertisement
sazid_iiuc

controller

Feb 2nd, 2021
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const contacts = require('./Contact');
  2.  
  3. exports.getAllContacts = (req, res) =>{
  4.     res.json(contacts.getAllContacts());
  5. }
  6.  
  7. exports.createContact = (req, res) => {
  8.     let {name, phone} = req.body;
  9.  
  10.     let contact = contacts.createContact({
  11.         name,
  12.         phone
  13.     })
  14.  
  15.     res.json(contact);
  16.  
  17.     console.log("Data Recieved in "+req.body);
  18.  
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement