adrianhajdin / project_mern_memories

This is a code repository for the corresponding video tutorial. Using React, Node.js, Express & MongoDB you'll learn how to build a Full Stack MERN Application - from start to finish. The App is called "Memories" and it is a simple social media app that allows users to post interesting events that happened in their lives.
https://youtube.com/playlist?list=PL6QREj8te1P7VSwhrMf3D3Xt4V6_SRkhu
4.95k stars 1.83k forks source link

Updated index.js file with configureStore() #179

Open AAdewunmi opened 6 months ago

AAdewunmi commented 6 months ago

Hi, thought I'd contribute this project by refactoring client/scr/index.js to use configureStore() method instead of createStore() method.

AAdewunmi commented 6 months ago

I've added another change without creating a separate branch. Change based on the following error: TypeError: PostMessage.findByIdAndRemove is not a function Fix:Update findByIdAndRemove(id) with findByIdAndDelete(id) Location: server/controllers/post.js - deletePost() Code Snippet:

export const deletePost = async (req, res) => {
  const { id } = req.params;
  if (!mongoose.Types.ObjectId.isValid(id))
    return res.status(404).send(`No post with id: ${id}`);
  await PostMessage.findByIdAndDelete(id); **<== Fix ===>** 
  res.json({ message: "Post deleted successfully." });
}