Group Chat Week 8 Solutions

Well done if you got these right!

  • Why isn’t the page loading correctly in this code?

    • We’re correctly getting the output from our logger middleware here in the console (if we refresh the browser window part of the screen, we get a new timestamp pop up).
    • The problem is that we’re not calling the next() function inside of this custom middleware! So this means that our request never leaves the logger, and doesn’t reach our GET endpoint.
  • What would we need to do to get the POST route to work in this code?

    • We need to enable JSON body parsing with the line app.use(express.json())
  • What URL do you need to visit with this code to get your name to show up on the screen?

    • For me, it was https://v6zmu.sse.codesandbox.io/Adam?lastName=Janes
  • What would the console log on line 21 output in this code?

    • This should give us the contents of the newly created User collection, which should be a 1-item array with the dummy name/email that we created.