I recently started learning MERN through a tutorial and encountered an issue with my database. I have successfully created a function to send data to the database, but for some reason, I can't see the data in the database. Below is the code snippet:
export const signup = async (req, res) => {
try {
// code logic here
} catch (error) {
console.log("Error in signup controller", error.message);
res.status(500).json({ error: "Internal Server Error" });
}
}
When attempting to access /api/auth/signup, I am receiving the following message:
cannot GET /api/auth/signup
I am considering whether this issue is due to using a POST request instead of a GET request. Additionally, when I attempt to send the data, I encounter the following error:
Error in signup controller Illegal arguments: undefined, string
At this point, I'm unsure how to proceed. Any advice would be greatly appreciated.