I am working on a project using Angular and Node for a job I am training for and am currently stuck trying to fix what appears to be my own misunderstanding of the FormData data type. I have isolated the problem to the following code:
const postData = new FormData();
postData.append("title", title);
postData.append("content", content);
this.http
.post<{ message: string; post: Post }>(
"http://localhost:3000/api/posts",
postData
)
Before this code is run, the variables that supply the data to the FormData contain the correct information, but on the backend the parameters come up undefined. Attempts to peer into the FormData are causing CORS errors that appear in no other contexts. Any help either letting me see into the FormData, better verifying what is happening on the backend, or using FormData in general would be appreciated.