I'm building a react app with node.js (express && multer) and mongodb. When i upload a pic - the file is stored in a folder and the object is created in mongodb, but i get a 200 status instead of 201. What should i add to get the correct status?
fetch("http://localhost:8080/addItems", {
method: "POST",
body: data,
})
.then(res => res.status !== 201 ? setFileExistsError(true) : setFileExistsError(false))
};
return(
<>
{fileExistsError && <p className="errorMsg">Item already exists</p>}
</>
)