Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. router.post("/addtodo", async (req, res) => {
  2. try {
  3. const updateUser = await User.updateOne(
  4. {
  5. _id: req.body._id
  6. },
  7. {
  8. $push: {
  9. todos: { title: req.body.title }
  10. }
  11. }
  12. );
  13. res.send("you added new todo");
  14. } catch (error) {
  15. res.send("Error");
  16. }
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement