Get Data from POST Requests

I’ve completed this challenge and it passes the tests but when i input the first and last names into the html and hit send i get {“name”:“undefined undefined”}. Im probably missing something simple but cant figure out what it is.

here is a link to my replit:
boilerplate-express (1) - Replit

If i remove the get request I get the proper output with the name. I am wondering why the get request is undefined and if a post request is all that is needed to get the proper output to json?

seems like you resolved it already

Did you delete the get request? With code i posted i still get undefined. The post request goes through first and gives the correct result then the get request goes through which gives still outputs undefined in the json. Maybe its my browser i am using edge? ill try a different browser

You can’t run it in the Webview you have to open it in a new tab.

https://boilerplate-express-1.craigmarc.repl.co

Otherwise, it does the GET request without the query params.

Alright it works when i do that i just thought that stopping the run and restarting it would work.

Also I just went back to my mongoose replit to play around with the code and use console logs to see the results of the various queries and I couldnt get any results in the console logs. So I checked the code which originally passed everything and it fails all of the tests except the first one to see if it is hooked up to the database correctly. Is there any reason that the working code should have stopped working? Its a little confusing

here is a link if you have some time to take a look at it

boilerplate-mongomongoose (1) - Replit

You are using the wrong Schema. Compare the Schema creation to the usage.

I had the code saved elsewhere and copied and pasted it back into replit and now it works maybe i changed something by accident but i have no idea what.

boilerplate-mongomongoose (1) - Replit

If you read the code I said to read, it should have been pretty clear. Your Mongoose Schema didn’t at all match the usage. It was the wrong Schema with completely different properties.

Weird because im pretty sure it was the same code that originally worked i cut and paste code to create notes for lessons and pasted the code back in and now it works. Maybe I changed something by accident cant imagine i changed the whole schema tho maybe i did.

Well, you did. I can’t really remember the Schema you had but I’m pretty sure it was from one of the other challenges. I seem to remember there being url related props, so it might have been the URL shortener Schema. As I said, I don’t remember the Schema you had but it was definitely not the one you have now.


Edit: I just noticed I had a fork of it. I was right, it was the URL shortener Schema.

const personSchema = new mongoose.Schema({
  urlId: String,
  url: Number,
  shorturl: [String]
});