I am not able to pass the following test case :
You can send a POST request to /api/threads/{board} with form data including text and delete_password . The saved database record will have at least the fields _id , text , created_on (date & time), bumped_on (date & time, starts same as created_on ), reported (boolean), delete_password , & replies (array).
Project link : https://replit.com/@AkshatPattiwar/Message-BoardFCCProject-1
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Challenge: Anonymous Message Board
Link to the challenge:
Hello!
You need to return an object with data instead of redirecting to another page, like so:
{
"_id": "nnnnnnnn",
"text": "The board text",
"created_on": "2021-12-20",
"bumped_on": "2021-12-20",
"reported": false,
"delete_password": "thePassword",
"replies": []
}
Basically, this should be the created object on the database.
Can you tell where should i write this code
Inside the route that handles the post of the /api/threads/{board}. Instead of res.redirect you should send an object as the response with res.json.
Still not getting it… It’s in the api.js file right? I tried but not able to do
Let’s go step by step…
First, where is the route that handles the post method of the /api/threads/{board}? Paste that code here (I want to make sure we understand each other
).