Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.post("/addtodo", async (req, res) => {
- try {
- const updateUser = await User.updateOne(
- {
- _id: req.body._id
- },
- {
- $push: {
- todos: { title: req.body.title }
- }
- }
- );
- res.send("you added new todo");
- } catch (error) {
- res.send("Error");
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement