My postman is showing:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /owners/create</pre>
</body>
</html>
and my code of the post request:
if (process.env.NODE_ENV === "development") {
router.post("/create", async function (req, res) {
let owners = await ownerModel.find();
if (owners.length > 0) {
return res
.send(503)
.send("You don't have permission to create a new owner.");
}
let {fullname, email, password} = req.body;
let createdOwner = await ownerModel.create({
fullname,
email,
password,
})
res.status(201).send(createdOwner);
});
}
how do solve it ?
i tried asking chat gpt my instructor could not tell now what can i do so i asked on this forum.
New contributor
KSHITIJ THAKUR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.